Skip to content

fix(cdk/overlay): overriding pointer-events style #21666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cdk/overlay/overlay-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export class OverlayRef implements PortalOutlet, OverlayReference {

/** Toggles the pointer events for the overlay pane element. */
private _togglePointerEvents(enablePointer: boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating renaming this at the same time to _disablePointerEvents since it never really does enable them anymore, it just disables or defaults...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO "toggle" still makes sense since the default is for them to be enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is in a css class though, this code really doesn't know and shouldn't care what that default is. Just my opinion though 🤷

this._pane.style.pointerEvents = enablePointer ? 'auto' : 'none';
this._pane.style.pointerEvents = enablePointer ? '' : 'none';
}

/** Attaches a backdrop for this overlay. */
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/overlay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('Overlay', () => {

expect(paneElement.childNodes.length).not.toBe(0);
expect(paneElement.style.pointerEvents)
.toBe('auto', 'Expected the overlay pane to enable pointerEvents when attached.');
.toBe('', 'Expected the overlay pane to enable pointerEvents when attached.');

overlayRef.detach();

Expand Down