Skip to content

fix(#1351): hide ScrollArea scrollbar when overlay is open#1997

Open
kotAPI wants to merge 3 commits into
mainfrom
fix/issue-1351-scrollarea-overlay-scrollbar
Open

fix(#1351): hide ScrollArea scrollbar when overlay is open#1997
kotAPI wants to merge 3 commits into
mainfrom
fix/issue-1351-scrollarea-overlay-scrollbar

Conversation

@kotAPI

@kotAPI kotAPI commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add document-level overlay tracking (data-rad-ui-overlay-open) with refcounting when Dialog, Popover, Menu, and Combobox primitives open.
  • Suppress ScrollArea scrollbar/thumb visibility while an overlay is open or body scroll is locked (e.g. modal scroll lock).
  • Add ScrollArea tests for overlay attribute and body scroll lock.

Fixes #1351

Test plan

  • npm test -- --testPathPatterns=ScrollArea.test
  • Open a page with ScrollArea behind a Dialog/Popover and confirm custom scrollbar hides while open
  • Confirm scrollbar returns when overlay closes

Track overlay open state on the document and suppress ScrollArea scrollbars when floating layers lock page scroll.
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: af685cb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Track floating overlays via data-rad-ui-overlay-open and body scroll lock so custom ScrollArea scrollbars stay hidden alongside native scrollbars when dialogs, menus, or other floating layers open.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@kotAPI, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 32 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea013db8-f9bb-44ed-a5d1-4f62a45e33b7

📥 Commits

Reviewing files that changed from the base of the PR and between fe87b36 and 76c8df6.

📒 Files selected for processing (15)
  • src/components/ui/Drawer/fragments/DrawerRoot.tsx
  • src/components/ui/ScrollArea/context/ScrollAreaContext.tsx
  • src/components/ui/ScrollArea/fragments/ScrollAreaRoot.tsx
  • src/components/ui/ScrollArea/fragments/ScrollAreaScrollbar.tsx
  • src/components/ui/ScrollArea/fragments/ScrollAreaThumb.tsx
  • src/components/ui/ScrollArea/tests/ScrollArea.test.tsx
  • src/core/hooks/useDocumentOverlayOpenState/index.ts
  • src/core/hooks/useRegisterDocumentOverlayOpen/index.ts
  • src/core/primitives/Combobox/fragments/ComboboxPrimitiveRoot.tsx
  • src/core/primitives/Dialog/fragments/DialogPrimitiveRoot.tsx
  • src/core/primitives/Menu/fragments/MenuPrimitiveRoot.tsx
  • src/core/primitives/Popover/fragments/PopoverPrimitiveRoot.tsx
  • src/core/utils/documentOverlayOpen/documentOverlayOpen.ts
  • src/core/utils/documentOverlayOpen/index.ts
  • src/setupTests.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1351-scrollarea-overlay-scrollbar

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

This report compares the PR with the base branch. "Δ" shows how the PR affects each metric.

Metric PR Δ
Statements 75.91% +0.18%
Branches 59.25% +0.08%
Functions 62.4% +0.65%
Lines 77.44% +0.18%

Coverage improved or stayed the same. Great job!

Run npm run coverage:ci locally for detailed reports and target untested areas to raise these numbers.

@kotAPI

kotAPI commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

LGTM. Matches project patterns for portal Theme refs, Floating UI prop merge, controlled-switch/lazy-mount/RTL tests, or focused bug fixes. No changes requested.

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.

BUG: When a floating element is triggered, ScrollArea Scrollbar needs to be hidden

1 participant