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

[Popper] Fix regression when an occluded submenu stays visible even with enabled hideWhenDetached flag #3237

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

Conversation

nikita-miro
Copy link

@nikita-miro nikita-miro commented Nov 20, 2024

Description

There seems to be a regression in react-popper component in versions 1.1.3 and newer, which affected submenus in scrollable menus.

Problem

When a menu is rendered, which

  • Has hideWhenDetached flag enabled.
  • Has a submenu.
  • Has menu height short enough to require scrolling to see the submenu.

Then in the latest versions of react-menu component this submenu stays on screen even when its parent item is scrolled out of the visible area.

Behavior in react-popper 1.1.2 and this branch Behavior in react-popper 1.1.3
Screen.Recording.2024-11-20.at.17.51.06.mov.mp4
Screen.Recording.2024-11-20.at.17.54.25.mov.mp4

Root cause

This regression seems to be caused by changes in this PR: #2185

Proposed changes

This PR adds an extra check for undefined collisionBoundary prop. When it's not defined, then we don't override the default boundary value passed to Floating UI helpers either.

A few tweaks are also made to the <Menu> component's storybook to reproduce the issue and test the fix.

@nikita-miro nikita-miro changed the title Fix regression in Popover component when an occluded submenu stays visible even with enabled hideWhenDetached flag [Popover] Fix regression when an occluded submenu stays visible even with enabled hideWhenDetached flag Nov 20, 2024
@nikita-miro nikita-miro changed the title [Popover] Fix regression when an occluded submenu stays visible even with enabled hideWhenDetached flag [Popper] Fix regression when an occluded submenu stays visible even with enabled hideWhenDetached flag Nov 22, 2024
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.

2 participants