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

Scrollbar not following activeIndex on Menu (when have fixed Height) #8444

Open
1 of 3 tasks
therrou opened this issue Apr 18, 2024 · 0 comments
Open
1 of 3 tasks

Scrollbar not following activeIndex on Menu (when have fixed Height) #8444

therrou opened this issue Apr 18, 2024 · 0 comments

Comments

@therrou
Copy link

therrou commented Apr 18, 2024

Description

When a Menu is used with a fixed height or maxHeight to avoid a large MenuList, and trying to navigate with the keyboards (arrow down, arrow up, or open the menu with space/enter) the scroll of the menu is not following the focused item, creating a problem for accessibility with keyboard. The issue is caused in the useMenu hook and the preventScroll: true from useUpdateEffect hook

Link to Reproduction

https://codesandbox.io/p/sandbox/busy-http-48t8rw?file=%2Fsrc%2Findex.tsx%3A22%2C20

Steps to reproduce

  1. In the sandbox, tab and set focus on the MenuButton element
  2. Open the Menu with arrow up, arrow down, Space or Enter
  3. The scrollbar of the menu is not following the active index. Below there is a container with focusable elements with the expected behaviour.

Chakra UI Version

2.8.2

Browser

123

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

Setting the preventScroll: false will fix the issue and considering that the menu could be used as a dropdown/selector (to have more flexibility and styles) I think would be a great improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant