Skip to content
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

fix(overlay): disable pointer events if overlay is detached #2747

Merged
merged 3 commits into from
Feb 2, 2017

Conversation

devversion
Copy link
Member

  • Currently the overlay element is still visible if the overlay has been detached.
    This is problematic if the overlay pane element has an height | wídth set from the state, because now the overlay element may block clicks on the page and overlap the actual content.

  • The issue isn't noticable for the select and other overlay components, because those don't specify a height | width in their state.
    Nevertheless the pane elements are still visible, but just have no height and width set.

Fixes #2739

* Currently the overlay element is still visible if the overlay has been detached.
  This is problematic if the overlay pane element has an `height | wídth` set from the state, because now the overlay element may block clicks on the page and overlap the actual content.

* The issue isn't noticable for the `select` and other overlay components, because those don't specify a `height | width` in their state.
   Nevertheless the pane elements are still visible, but just have no height and width set.

Fixes angular#2739
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 21, 2017
@jelbourn
Copy link
Member

@devversion detach triggers the animations, so hiding it right away would prevent those from running

@devversion devversion force-pushed the fix/overlay-hide-pane-element branch from fb50b3d to 275bd82 Compare January 24, 2017 10:30
@devversion
Copy link
Member Author

@jelbourn Good point - I think another idea is to disable pointerEvents if detached. This also ensures that the overlay pane doesn't block any underlying content.

@devversion devversion requested a review from jelbourn January 24, 2017 10:32
@devversion devversion changed the title fix(overlay): hide pane element if detached fix(overlay): disable pointer events if overlay is detached Jan 24, 2017
@devversion devversion requested a review from crisbeto January 30, 2017 21:09
crisbeto
crisbeto previously approved these changes Jan 30, 2017
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM, just the one minor note.

@@ -29,16 +29,25 @@ describe('Overlay directives', () => {
fixture.detectChanges();
});

/** Returns the current open overlay pane element. */
function getPaneElement() {
Copy link
Member

Choose a reason for hiding this comment

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

It may be better to use querySelector here, otherwise the test will break if we changed the DOM order.

Copy link
Member

Choose a reason for hiding this comment

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

As long as there's a unit test for the behavior it should be okay

Copy link
Member Author

@devversion devversion Jan 31, 2017

Choose a reason for hiding this comment

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

Yeah it shouldn't be necessary. Nevertheless I just changed it (Testing the dismiss review button)

this.updateSize();
this.updateDirection();
this.updatePosition();

// Enable pointer events for the overlay pane element.
this._togglePointerEvents(true);
Copy link
Member

Choose a reason for hiding this comment

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

Aren't these enabled by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah they are enabled by default. But developers can always call attach after detach has been called. This is necessary to revert the togglePointerEvents(false) from the detach method.

@devversion devversion dismissed crisbeto’s stale review January 31, 2017 10:14

Testing this functionality.

@devversion
Copy link
Member Author

Okay that didn't look pretty good 😄 Should be ready for another review.

@mmalerba mmalerba self-requested a review January 31, 2017 17:51
@devversion devversion added the action: merge The PR is ready for merge by the caretaker label Jan 31, 2017
@kara kara merged commit 453fa7f into angular:master Feb 2, 2017
@devversion devversion deleted the fix/overlay-hide-pane-element branch February 10, 2017 06:24
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(overlay): cdk-connected-overlay with size dont remove cdk-connected-pane on close
6 participants