Repository navigation
fix(core): coordinate concurrent useScrollLock instances - #4788
Merged
cixzhang merged 4 commits intoAug 13, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
August 7, 2026 11:43
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
rubyycheung
approved these changes
Aug 7, 2026
cixzhang
approved these changes
Aug 13, 2026
cixzhang
left a comment
Contributor
There was a problem hiding this comment.
Thanks this seems good for nested dialogs
cixzhang
enabled auto-merge (squash)
August 13, 2026 04:40
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4787
useScrollLockhad no coordination between instances — each call independently snapshotteddocument.body.stylewhen its own effect mounted and restored that exact snapshot on cleanup. With two overlays open at once (e.g. a Lightbox opened from within a Dialog), closing them out of stacking order could unlock the body while one was still open, and could leave the body permanently stuck locked after both closed.Changes
useScrollLocknow coordinates locks with a shared counter: the original body state is captured only when the count goes 0→1, and only restored when it goes back to 0, regardless of which instance closes first.Test plan
pnpm -F @astryxdesign/core test -- useScrollLock— all pass, including the new concurrent-instance tests, which fail against the prior per-instance-snapshot implementation.Dialog,Lightbox,Drawer,BottomSheetsuites (the hook's real consumers) still pass — no regressions.pnpm check:changesets