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(material/menu): not interrupting keyboard events to other overlays #22856

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jun 1, 2021

For historical reasons, mat-menu doesn't use the same keyboard event dispatcher as the other overlays. To work around it, previously we added a dummy subscription so that the menu would still show up in the overlay keyboard stack.

This works for most events, but it breaks down for the escape key, because closing the menu removes it from the stack immediately, allowing the event to bubble up to the document and be dispatched to the next overlay in the stack.

These changes resolve the issue by adding a stopPropagation call.

Fixes #22694.

For historical reasons, `mat-menu` doesn't use the same keyboard event dispatcher as the other overlays. To work around it, previously we added a dummy subscription so that the menu would still show up in the overlay keyboard stack.

This works for most events, but it breaks down for the escape key, because closing the menu removes it from the stack immediately, allowing the event to bubble up to the document and be dispatched to the next overlay in the stack.

These changes resolve the issue by adding a `stopPropagation` call.

Fixes angular#22694.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jun 1, 2021
@crisbeto crisbeto requested a review from jelbourn June 1, 2021 15:54
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 1, 2021
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

lgtm, though I expect this will end up being some degree of breaking inside Google

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Jun 1, 2021
@andrewseguin andrewseguin merged commit aeecb3c into angular:master Jun 7, 2021
andrewseguin pushed a commit that referenced this pull request Jun 7, 2021
#22856)

For historical reasons, `mat-menu` doesn't use the same keyboard event dispatcher as the other overlays. To work around it, previously we added a dummy subscription so that the menu would still show up in the overlay keyboard stack.

This works for most events, but it breaks down for the escape key, because closing the menu removes it from the stack immediately, allowing the event to bubble up to the document and be dispatched to the next overlay in the stack.

These changes resolve the issue by adding a `stopPropagation` call.

Fixes #22694.

(cherry picked from commit aeecb3c)
andrewseguin added a commit to andrewseguin/components that referenced this pull request Jun 8, 2021
andrewseguin added a commit that referenced this pull request Jun 9, 2021
andrewseguin added a commit that referenced this pull request Jun 9, 2021
… overlays (#22856)" (#22924)

This reverts commit aeecb3c.

(cherry picked from commit 764c150)
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jun 9, 2021
This is a resubmit of angular#22856 which had some issues in g3.

For historical reasons, `mat-menu` doesn't use the same keyboard event dispatcher as the other overlays. To work around it, previously we added a dummy subscription so that the menu would still show up in the overlay keyboard stack.

This works for most events, but it breaks down for the escape key, because closing the menu removes it from the stack immediately, allowing the event to bubble up to the document and be dispatched to the next overlay in the stack.

These changes resolve the issue by adding a stopPropagation call.

Fixes angular#22694.
@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 Jul 8, 2021
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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(cdk/overlay): cdkConnectedOverlay closes on escape even when another overlay is open
3 participants