Skip to content

Commit

Permalink
fix(cdk/overlay): overriding pointer-events style (#21666)
Browse files Browse the repository at this point in the history
We set `pointer-events: auto` on the overlay when it is attached and then `none` while it's
detaching which ends up overriding any other styles the user might have. These changes
reset to `''` instead.

Fixes #21656.

(cherry picked from commit 9e87050)
  • Loading branch information
crisbeto authored and andrewseguin committed Jan 25, 2021
1 parent cf30c44 commit ba41912
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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) {
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

0 comments on commit ba41912

Please sign in to comment.