-
Notifications
You must be signed in to change notification settings - Fork 7
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
Cat-dropdown: focus-trap library conflicts with FocusMonitor(@angular/cdk/a11y) #496
Comments
focus-trap/focus-trap#1165 - added a ticket to focus-trap repo |
This is a Zone.js issue: |
At the risk of butting my nose in where it may not belong,
That's one way to go. On the other hand, the Perhaps another way to address this would be to fork And I guess another solution would be to fork |
Hello @stefcameron! Thanks for stopping by,
But since there is a workaround with |
When user uses Tab for navigation inside
cat-dropdown
the first element is not reachable. It's reproducible only when FocusMonitor service is imported and provided into any component in the tree.The reason underhood is that the focus-trap library uses
preventDefault
inside Tab keydown event handler in order to not let browser natively navigate the the next focusable element after programmatically setup the focus on the first element:https://github.com/focus-trap/focus-trap/blob/master/index.js#L762
In the same time
InputModalityDetector
class, which is used byFocusMonitor
, add event listener to keydown event with configurationpassive: true
https://github.com/angular/components/blob/main/src/cdk/a11y/input-modality/input-modality-detector.ts#L196
which prevent
preventDefault
(ironically).But to be honest I'm not sure why keydown event handler from focus-trap library which was defined with
passive: false
is impacted by options of event listener fromInputModalityDetector
.How we can possible resolve it? Maybe we can start from creating the issue ticket in focus trap repo, seems like they are responded quickly. In the case it's gonna be resolved the only thing we need to do is to update the library version.
The text was updated successfully, but these errors were encountered: