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

Using ref on MenuList breaks MenuList functionality #306

Open
olivercoad opened this issue Jan 23, 2025 · 0 comments
Open

Using ref on MenuList breaks MenuList functionality #306

olivercoad opened this issue Jan 23, 2025 · 0 comments

Comments

@olivercoad
Copy link

I wanted to use a ref with MenuList, but after adding the ref a lot of functionality stopped working, such as the up/down arrows:

MenuList.jsx:62 Uncaught TypeError: Cannot read properties of undefined (reading 'firstChild')
    at moveFocus (MenuList.jsx:62:32)
    at HTMLUListElement.handleKeyDown [as $$keydown] (MenuList.jsx:150:13)

After doing some debugging, I found that the issue is the use of {...other} spread makes the props.ref override the listRef. I think a solution could be to add "ref" into the splitProps call.

I haven't checked if other components have similar issues.

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