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
{{ message }}
Repository navigation
[dialog] scroll locking mechanism doesn't handoff well with non-base ui modal overlays #4640
When opening a base ui Dialog from another non-base ui modal overlay, it is possible that the page's scroll ends up in an unrecoverable locked state:
For example, Ariakit Menu adds a delay to its "scroll lock cleanup" to wait for animations/transitions, which causes the following bug:
Menu opens and sets overflow: hidden on the page
Menu item is clicked — Menu starts closing, but delays its scroll-lock cleanup to respect the animation
Dialog opens before the Menu's scroll lock cleanup has happened. It snapshots the situation (eg page is scroll-locked), then applies its own scroll lock logic, which wrongly restores page scrolling while dialog is opened
When the Dialog closes, it restores the previous snapshot and the page stays scoll-locked
So far, I managed to avoid the issue with a couple of workarounds:
trick ariakit by moving the animation on child of the popup element, so that ariakit executes scroll lock cleanup without any delays;
manually prevent scroll lock on the Ariakit Menu (not ideal, but seems to work);
Although I wonder if base UI could make improvemens on their side to improve scroll-lock handoff
Expected behavior
I wish base ui could coordinate cross-library scroll-lock handovers.
A few ideas:
Come up with a robust heuristic for better coordination/restoration. For example:
it should not be possible for Dialog's scroll-lock logic to enable page scroll when opening;
it should not be possible for Dialog's scroll-lock cleanup logic to scroll-lock the page (ie add overflow: hidden) when closing
expose a pluggable scroll-lock manager and/or explicit interop hooks
changed the title [-][Dialog] scroll locking mechanism doesn't handoff well with non-base ui modal overlays[/-][+][dialog] scroll locking mechanism doesn't handoff well with non-base ui modal overlays[/+]on May 8, 2026
this issue also happens when using silk-hq, once you close their drawer and immediately open the base-ui dialog the scroll lock becomes inverted: scrollable while dialog opened, hidden once closed.
Activity
[-][Dialog] scroll locking mechanism doesn't handoff well with non-base ui modal overlays[/-][+][dialog] scroll locking mechanism doesn't handoff well with non-base ui modal overlays[/+]maiconcarraro commentedon Jul 16, 2026
this issue also happens when using silk-hq, once you close their drawer and immediately open the base-ui dialog the scroll lock becomes inverted: scrollable while dialog opened, hidden once closed.
github-actions commentedon Jul 19, 2026
This fix will be available in the next npm release of Base UI.
In the meantime, you can try it out on our Canary release channel: