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

feat(cdk/focus-trap) Add ConfigurableFocusTrap tab-wrapping strategies #18282

Closed
wants to merge 1 commit into from

Conversation

vanessanschmitt
Copy link
Collaborator

@vanessanschmitt vanessanschmitt commented Jan 24, 2020

This commit adds a new required strategy parameter to ConfigurableFocusTrap that dictates how it wraps tab, and two implementations of the new strategy.

TabStopFocusTrapWrapStrategy has the same behavior as legacy FocusTrap. It adds hidden tab stops that redirect focus before and after the FocusTrap elements.

TabListenerFocusTrapWrapStrategy caches the first and last element in
the ConfigurableFocusTrap. It intercepts tab/shift-tab on these elements
in order to wrap tab. It updates the cache when the FocusTrap DOM subtree
has a tab-relevant change.

For now, TabStopFocusTrapWrapStrategy is the default strategy in ConfigurableFocusTrapFactory, to simplify migration.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 24, 2020
This commit adds a new required strategy parameter to
ConfigurableFocusTrap that dictates how it wraps tab focus, and two
implementations of the new strategy.

TabStopFocusTrapWrapStrategy has the same behavior as legacy FocusTrap.
It adds hidden tab stops that redirect focus before and after the
FocusTrap elements.

TabListenerFocusTrapWrapStrategy caches the first and last element in
the ConfigurableFocusTrap. It intercepts tab/shift-tab on these
elements in order to wrap tab. It updates the cache when the FocusTrap
DOM subtree has a tab-relevant change.

For now, TabStopFocusTrapWrapStrategy is the default strategy in
ConfigurableFocusTrapFactory, to simplify migration.
@vanessanschmitt
Copy link
Collaborator Author

Closing because Axe 3.5.0 will downgrade aria-hidden-focus errors from “Severe” to “Needs Review” when a modal dialog (a dialog element, an element with aria-modal=”true”, or an element with role=”dialog”) is open on the page. This eliminates the primary impetus for removing the hidden tab stops.

Axe PR: dequelabs/axe-core#1995

@vanessanschmitt vanessanschmitt deleted the tab-stops branch March 17, 2020 21:52
@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 Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

2 participants