Skip to content

refactor(Selector): the presentation controller holds its choice through the layer runtime's presentation hold - #8591

Open
cixzhang wants to merge 1 commit into
feat/presentation-holdfrom
feat/presentation-hold-selector
Open

cixzhang wants to merge 1 commit into
feat/presentation-holdfrom
feat/presentation-hold-selector

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #8587 (the layer runtime's presentation hold). The base is its branch, so this diff is only the Selector adoption.

What it does

useSelectorPresentation, the presentation controller Selector and MultiSelector share, kept two latches of its own:

  • activePresentationRef: the presentation an opening chose (sheet or popover). It's now a createPresentationHold, taken at show().
  • isSheetPresented: the sheet kept mounted after it closes, until BottomSheet's final-focus handoff reaches the trigger. It's now a usePresentationHold over the sheet's open state.

Both are released exactly where the old state was cleared: when the trigger takes focus after the sheet's exit, and, for the sheet hold, when a popover opens instead. architecture:layer-runtime INV14 names this job, keeping a layer's chosen presentation from the open until its close settles, as the runtime's.

No behavior change

Selector's and MultiSelector's tests are the oracle and pass unchanged (486), including the sheet presentation's exit and its focus return to the trigger. The real-browser check is their specs, which this PR's CI runs because the change touches the Selector folder.

Size (gzip KB, minified)

The same method as #8587: a fresh packages/core dist at the base and at this head; esbuild bundle, minify, splitting, ESM, packages external.

Component Desktop Phone
Selector 65.73 → 65.90 (+0.17) 82.58 → 82.75 (+0.17)
MultiSelector 62.34 → 62.51 (+0.17) 75.56 → 75.73 (+0.17)

Testing

  • pnpm vitest run --project ui packages/core/src/Selector packages/core/src/MultiSelector: 486 pass.
  • tsc and eslint clean.
  • [chore] changeset.

…ugh the layer runtime's presentation hold

useSelectorPresentation (Selector and MultiSelector) kept two latches of its
own: activePresentationRef, the presentation an opening chose, and
isSheetPresented, the sheet kept mounted after it closes until BottomSheet's
focus handoff reaches the trigger. Both now use the layer runtime's
presentation hold (Layer/presentationHold): createPresentationHold taken at
show, and usePresentationHold over the sheet's open state, released where
the old state was cleared. No behavior change; Selector and MultiSelector
tests pass unchanged.
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 26, 2026 9:09pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 26, 2026, 9:32 PM UTC

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommending approval. useSelectorPresentation now keeps the opening's presentation and the closing bottom sheet through the layer runtime's presentation hold, as architecture:layer-runtime INV14 asks, and Selector and MultiSelector behave as they do on the base branch: the unit suites pass, a presentation-flip check matches state for state, and Chromium captures of both surfaces are pixel-identical. Two small follow-ups:

  • The layer-runtime record's current-gaps paragraph on the base branch names only Popover as using the shared presentation hold and still lists Selector among components that build their own; please amend it in whichever of #8587 and this PR lands last.
  • CI runs only for pull requests into main and release branches, so the Selector specs the description mentions have not run on this branch yet.

[Automated review]

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026

This branch was successfully deployed

1 active deployment
Preview — 65be45bc Deployed Oct 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant