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

[base-ui][Menu] Incorrect up arrow key behavior #40596

Closed
michaldudak opened this issue Jan 15, 2024 · 3 comments · Fixed by #40764
Closed

[base-ui][Menu] Incorrect up arrow key behavior #40596

michaldudak opened this issue Jan 15, 2024 · 3 comments · Fixed by #40764
Assignees
Labels
bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base

Comments

@michaldudak
Copy link
Member

michaldudak commented Jan 15, 2024

The Up Arrow opens the menu, but it focuses the first menu item. It should focus the last menu item.

Search keywords:

@michaldudak michaldudak added bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Jan 15, 2024
@Jaswanth-Sriram-Veturi
Copy link
Contributor

Hey @michaldudak, can I work on this issue?

@michaldudak
Copy link
Member Author

Go ahead!

@Jaswanth-Sriram-Veturi
Copy link
Contributor

This is my first time contributing to this repository, I wanted to share my approach and receive feedback. After going through the codebase, I suspect that this bug is encountered when the menu is opened via the UpArrow key, ListActionTypes.itemsChange action is dispatched then in the list reducer moveHighlight function is called with reset as offset. I think this can be fixed by tracking keyPressed and storing it in dropdown context and accessing keyPressed value in moveHighlight function and we focus last menu item if UpArrow key is pressed. If DownArrow is pressed then we focus first menu item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
2 participants