-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(overlay): stop using capture phase for overlay keyboard handling #16019
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
Conversation
b0bbc54
to
aa8fe3c
Compare
OverlayKeyboardDispatcher is a document-level keyboard listener that dispatches events to the topmost overlay that's listening for them. It does it on capture as of e30852a in order to avoid missing events whose propagation have been stopped. However, there are legitimate use cases for stopping propagation and not wanting the overlay to hear about it. For example, grid navigation based on the ARIA best practice allows for enter to trap focus inside a grid cell and escape to leave it and restore focus to the grid cell. https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_inside In these cases, we must be able to call stopPropagation and prevent the escape keypress event from reaching the overlay. Fixes angular#9928. BREAKING CHANGE: OverlayKeyboardDispatcher (used in dialog and overlay and available in the CDK) now listens on bubbling/propagation phase instead of capture phase. This means that overlay keydown handlers are now called after any applicable handlers inside of an overlay, and it respects any stopPropagation() calls from inside the overlay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…16019) OverlayKeyboardDispatcher is a document-level keyboard listener that dispatches events to the topmost overlay that's listening for them. It does it on capture as of e30852a in order to avoid missing events whose propagation have been stopped. However, there are legitimate use cases for stopping propagation and not wanting the overlay to hear about it. For example, grid navigation based on the ARIA best practice allows for enter to trap focus inside a grid cell and escape to leave it and restore focus to the grid cell. https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_inside In these cases, we must be able to call stopPropagation and prevent the escape keypress event from reaching the overlay. Fixes #9928. BREAKING CHANGE: OverlayKeyboardDispatcher (used in dialog and overlay and available in the CDK) now listens on bubbling/propagation phase instead of capture phase. This means that overlay keydown handlers are now called after any applicable handlers inside of an overlay, and it respects any stopPropagation() calls from inside the overlay.
…ngular#16019) OverlayKeyboardDispatcher is a document-level keyboard listener that dispatches events to the topmost overlay that's listening for them. It does it on capture as of e30852a in order to avoid missing events whose propagation have been stopped. However, there are legitimate use cases for stopping propagation and not wanting the overlay to hear about it. For example, grid navigation based on the ARIA best practice allows for enter to trap focus inside a grid cell and escape to leave it and restore focus to the grid cell. https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_inside In these cases, we must be able to call stopPropagation and prevent the escape keypress event from reaching the overlay. Fixes angular#9928. BREAKING CHANGE: OverlayKeyboardDispatcher (used in dialog and overlay and available in the CDK) now listens on bubbling/propagation phase instead of capture phase. This means that overlay keydown handlers are now called after any applicable handlers inside of an overlay, and it respects any stopPropagation() calls from inside the overlay.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OverlayKeyboardDispatcher is a document-level keyboard listener that
dispatches events to the topmost overlay that's listening for them.
It does it on capture as of e30852a in order to avoid missing events
whose propagation have been stopped. However, there are legitimate use
cases for stopping propagation and not wanting the overlay to hear about
it. For example, grid navigation based on the ARIA best practice allows
for enter to trap focus inside a grid cell and escape to leave it and
restore focus to the grid cell.
https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_inside
In these cases, we must be able to call stopPropagation and prevent the
escape keypress event from reaching the overlay.
Fixes #9928.