-
-
Notifications
You must be signed in to change notification settings - Fork 14
Keyboard List/Menu navigation #310
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for reablocks-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| const onKeyDown = useCallback((e: KeyboardEvent) => { | ||
| e.stopPropagation(); | ||
| if (e.key === 'ArrowLeft' || e.key === 'Escape') { |
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.
Wouldn't escape close the menu all together? I know the ExitListener often is handling this. Just calling this out.
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.
It is closing, but all levels together. But we need to give user ability get back to previous level
| const theme: ListTheme = useComponentTheme('list', customTheme); | ||
| const containerRef = useRef<HTMLDivElement>(null); | ||
|
|
||
| const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => { |
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.
Im not sure I agree this should be in List ( or at least not in the base list component ).
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.
Why not in the List? It is have the same functionality as menu and user should have ability to navigate it in the same way/
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.
Also, it works only for items with tab index (simplly say which have onClick callback)
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.
I think we should make a MenuList and MenuListItem that wraps the base List/ListItem and attaches these. Thoughts?
If we don't need navigation in the List component then make sense. |
Lists don't need keyboard nav like this since they have tab navigation natively. |
Ok, will update. |
Thanks. Once done, don't forget to add docs about this. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Issue #309
What is the current behavior?
No way to navigate through Menu/List with the keyboard
What is the new behavior?
Added ability to navigate through Menu/List with the keyboard
Does this PR introduce a breaking change?
Other information
Screen.Recording.2025-10-02.at.13.38.09.mov