You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AMenu UI does not follow the trigger (.i.e., the anchorRef prop) when the containing element of the anchorRef is positioned as fixed.
A realistic instance of this problem is when AMenu is used in a header component with a positioned as fixed. Menus are often used to open actionable profile and account links.
Edit the playground code by adding a style={{ position: "fixed" }} to the most parent <div> element.
Click any of the buttons
With the menu opened, scroll down on the page
Expected behavior
The menu UI should follow along the trigger that is positioned as fixed.
Screenshots
Notice how the menu stays stuck while the triggers (the button elements) move down the page:
Environment (please complete the following information):
Device: Desktop
OS: MacOS
Browser: Chrome, Safari, Firefox
Additional context
The menu is positioned correctly on the initial open, but any scrolling causes the bug. This has to do with the appRef and wrapRef variables, which most likely need to be updated in the positioning function to reflect the containing element which is positioned as fixed (how we do this elegantly is yet TBD).
Edit 1:
Adding a scroll event listener could resolve the issue, but updating an inlined style on every scroll is unideal for performance. See below for an example of 4x CPU demonstration (I know the demo looks a bit strange, but I needed a fixed anchor element (the button) to make this work):
scroll-listener-demo.mov
Edit 2:
This will require AMenu to be positioned as fixed, which is something I'd rather have passed as compared to writing logical to determine if its parent is fixed.
The text was updated successfully, but these errors were encountered:
Describe the bug
The
AMenu
UI does not follow the trigger (.i.e., theanchorRef
prop) when the containing element of theanchorRef
is positioned asfixed
.A realistic instance of this problem is when
AMenu
is used in a header component with a positioned asfixed
. Menus are often used to open actionable profile and account links.To Reproduce
Steps to reproduce the behavior:
style={{ position: "fixed" }}
to the most parent<div>
element.Expected behavior
The menu UI should follow along the trigger that is positioned as
fixed
.Screenshots
Notice how the menu stays stuck while the triggers (the button elements) move down the page:
Environment (please complete the following information):
Additional context
The menu is positioned correctly on the initial open, but any scrolling causes the bug. This has to do with the
appRef
andwrapRef
variables, which most likely need to be updated in the positioning function to reflect the containing element which is positioned asfixed
(how we do this elegantly is yet TBD).Edit 1:
Adding a scroll event listener could resolve the issue, but updating an inlined style on every scroll is unideal for performance. See below for an example of 4x CPU demonstration (I know the demo looks a bit strange, but I needed a
fixed
anchor element (the button) to make this work):scroll-listener-demo.mov
Edit 2:
This will require
AMenu
to be positioned asfixed
, which is something I'd rather have passed as compared to writing logical to determine if its parent is fixed.The text was updated successfully, but these errors were encountered: