-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(a11y): Add optional home/end key support to ListKeyManager #19834
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
For some components like menus and listboxes, WAI a11y recommends that pressing home or end should focus the first or last element respectively. Add support for home/end to ListKeyManager.
Thoughts on making this the default behavior? I'm actually surprised that we didn't do this already. |
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.
We used to have this inside the ListKeyManager
, but we slowly transitioned to doing it on a case-by-case basis, because there are some places where home/end already do something. E.g. in an input
they were conflicting with the native behavior that moves the caret to the start/end.
Thanks for the context, @crisbeto! That makes sense why we wouldn't want this to be the default behavior. I'm migrating a bunch of my team's components to use the cdk KeyManager classes, and one of my main justifications is "Look how many lines of custom code I removed!" haha. A lot of them have duplicate Home/End key logic, so I'd love to be able to remove that too by making this an option in ListKeyManager... |
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
@googlebot Ping |
Based on top of angular#19834, changes the places where we were handling home/end to go through the key manager. Also allows `withHomeAndEnd` to be turned off, similarly to what we're doing with the other methods.
Based on top of angular#19834, changes the places where we were handling home/end to go through the key manager. Also allows `withHomeAndEnd` to be turned off, similarly to what we're doing with the other methods.
Based on top of angular#19834, changes the places where we were handling home/end to go through the key manager. Also allows `withHomeAndEnd` to be turned off, similarly to what we're doing with the other methods.
Based on top of angular#19834, changes the places where we were handling home/end to go through the key manager. Also allows `withHomeAndEnd` to be turned off, similarly to what we're doing with the other methods.
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. |
For some components like menus and listboxes, WAI a11y recommends
that pressing home or end should focus the first or last element
respectively. Add support for home/end to ListKeyManager.