Skip to content

Conversation

@huntabyte
Copy link
Owner

Closes #1639

This pull request addresses a race condition in the scroll lock and restore logic. The core improvement is a more robust mechanism for handling the timing of scroll lock cleanup, ensuring that the body style is not reset prematurely when multiple scroll locks are created or destroyed in quick succession.

Scroll Lock Race Condition Fixes:

  • Introduced a scheduling system (scheduleCleanupIfNoNewLocks) to delay and coordinate cleanup of scroll lock, preventing the body style from being reset if a new lock is added immediately after one is removed. This addresses issues where overlays/menus could break due to premature cleanup.
  • Added logic to cancel any pending cleanup when a new lock is created, ensuring that only the most recent cleanup is executed.
  • Ensured initial body styles are captured only once per locking session, preventing style loss during rapid lock/unlock cycles.

@huntabyte huntabyte added the publish:preview Add to PRs to publish preview packages with `pkg-pr-new` label Aug 5, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 5, 2025

🦋 Changeset detected

Latest commit: 41626f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bits-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 5, 2025

Open in StackBlitz

npm i https://pkg.pr.new/bits-ui@1700

commit: 41626f9

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview 41626f9

@huntabyte huntabyte merged commit 591fa93 into main Aug 6, 2025
7 of 8 checks passed
@huntabyte huntabyte deleted the fix/1639 branch August 6, 2025 18:04
@github-actions github-actions bot mentioned this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

publish:preview Add to PRs to publish preview packages with `pkg-pr-new`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pointer-events: none remains on body after dialog closes when preloadData is called in dropdown onSelect

2 participants