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

fix(@radix-ui/react-menu): Dropdown Scrolling Issue (handle negative offsetY on onPointerMove) #2869

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gunhoflash
Copy link

Description

Issue with video

This video shows a scrolling issue that occurs in dropdown with max-height and overflow: scroll set.

In this video, I never scrolled but only move the mouse pointer near the bottom edge of the dropdown.

2024-04-29.1.14.33.mov

Summary

  • In a dropdown with max-height and overflow: scroll, hovering over an item can trigger dropdown scrolling.
  • However, when the pointer is at the bottom edge of the dropdown, an onPointerMove event is triggered for the next item that is out of view(with negative offsetY), causing focus to shift to that item and resulting in continuous scrolling.
  • This issue means that the dropdown can be continuously scrolled with just pointer movement. This can lead users to click incorrectly or get confused.

Solution

  • This PR fixes an issue where the onPointerMove handler in MenuItemImpl was treating PointerEvent with offsetY < 0 as an entering item.
  • It now treats offsetY < 0 as a leaving item to prevent the dropdown scroll issue.

Testing

  • Tested the fix in the scenario where the issue was reproducible and confirmed that it is resolved.

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

Successfully merging this pull request may close these issues.

None yet

1 participant