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

[Bug]: Listbox Hover Focus Shouldn't Cause Scroll #769

Closed
agusterodin opened this issue Aug 27, 2021 · 1 comment · Fixed by #1161
Closed

[Bug]: Listbox Hover Focus Shouldn't Cause Scroll #769

agusterodin opened this issue Aug 27, 2021 · 1 comment · Fixed by #1161

Comments

@agusterodin
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.4.0

What browser are you using?

Chrome

Reproduction repository

https://headlessui.dev/react/listbox

Describe your issue

Add a max height to the first listbox example on the page. Notice that when hovering over an item with the mouse, the newly focused item gets scrolled to. This behavior is desirable for keyboard up + down navigation but is super janky when using the mouse.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus <- take advantage of the preventScroll property for mouse hover events only. Keyboard focus scroll should remain intact!

This video is literally just me hovering, not using touchpad scroll or keyboard:

Headless.UI.Mouse.Focus.Scroll.Bug.mov
@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

This should be fixed, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders or yarn add @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders or yarn add @headlessui/vue@insiders.

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