Skip to content

Select: do not lock document scroll when the options open - #128

Merged
DerekAgility merged 1 commit into
mainfrom
dlo/select-no-scroll-lock
Sep 23, 2026
Merged

DerekAgility merged 1 commit into
mainfrom
dlo/select-no-scroll-lock

Conversation

@DerekAgility

@DerekAgility DerekAgility commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Opening a Select locked document scroll. The whole consumer app shifted left by the scrollbar width and a white bar appeared where the scrollbar had been. Reproduced in the Manager App on the Pages screen with the Build Pages From select in the page properties side panel.

Root cause

Select renders ComboboxOptions with anchor="bottom start". In Headless UI 2.1 ComboboxOptions is modal by default, and a modal panel applies Headless UI's document scroll lock: overflow: hidden on <html> plus a padding-right equal to the scrollbar width (hooks/document-overflow/adjust-scrollbar-padding.js). A dropdown should not lock page scroll.

While checking the other option panels I found the modal default is not tied to anchor in 2.1.10. The older, unanchored ComboBox component locks scroll the same way, confirmed with a throwaway jsdom test.

Changes

  • stories/molecules/inputs/select/Select.tsx: modal={false} on ComboboxOptions.
  • stories/molecules/inputs/combobox/ComboBox.tsx: modal={false} on Combobox.Options, same default, same dropdown semantics.
  • stories/molecules/inputs/select/tests/Select.test.tsx: new test opens the select and asserts document.documentElement has no inline overflow or padding-right. It fails on main with overflow: hidden and passes with the fix.
  • package.json: Headless UI peer ranges were still ^1.7.10 / ^0.1.2 while the code depends on the 2.1 API and the modal prop, which does not exist in v1. Peers are now ^2.1.0 / ^0.2.1, and the dependency range is ^2.1.0 to match.
  • yarn.lock: only the @headlessui/react range key changed. The resolved version stays 2.1.10 with the same integrity hash. A plain yarn install against the new range would have upgraded to 2.2.10 and pulled in react-aria; I deliberately did not take that upgrade here.

Reviewed and left alone

  • DropdownWithMultiSelect uses an anchored PopoverPanel. PopoverPanel defaults modal to false, so it never locked scroll.
  • DropdownComponent uses Floating UI, not Headless UI. Its modal={true} is on FloatingFocusManager and controls focus trapping, not scroll.
  • No ListboxOptions or MenuItems usages in the repo.

Consumer note

Tightening the peer range means consumers on Headless UI 1.x get an install-time peer warning (yarn 1) or error (npm 7+) instead of the runtime breakage they already had with the current Select. Worth confirming the Manager App is on 2.x before release.

Not in this PR

No version bump or CHANGELOG.md entry. Release is handled separately.

Verification

  • yarn vitest run: 63 passed (62 existing + 1 new)
  • yarn lint: clean
  • tsc --noEmit: clean
  • yarn install --frozen-lockfile: passes

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
plenum-ui Ready Ready Preview Sep 23, 2026 4:53pm UTC

Request Review

Headless UI 2.1 makes ComboboxOptions modal by default, which applies its
scroll lock to <html> (overflow: hidden plus a padding-right equal to the
scrollbar width). Opening a Select shifted the consumer app sideways and left
a blank bar where the scrollbar was. A dropdown should not lock page scroll,
so pass modal={false} on Select's options panel and on the older ComboBox's
options panel, which had the same default.

Align the Headless UI peer ranges with the 2.1 API the code depends on. The
resolved version in yarn.lock stays at 2.1.10; only the range key changed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DerekAgility
DerekAgility merged commit c81ec03 into main Sep 23, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — c7afbbd8 Deployed Sep 23, 2026 by vercel[bot]
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.

2 participants