Skip to content

fix(Selector): the selected row stays on the trigger as the list grows - #10062

Merged
cixzhang merged 49 commits into
meta:mainfrom
vjeux:selector-overlay-clamp-translate
Nov 17, 2026
Merged

cixzhang merged 49 commits into
meta:mainfrom
vjeux:selector-overlay-clamp-translate

Conversation

@vjeux

@vjeux vjeux commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A default Selector (no placement, no search) whose open list grows, as when a late web font makes an option taller.

  • Mid-viewport, a first option grown to 96 px leaves the selected row 63 px off the trigger.
  • Near the viewport's end, the grown list runs past the viewport, and its last options cannot be pointed at.

Problem and solution fit

The overlay measured its margin only when the list opened. Near the viewport's end, the grown list overflowed and the browser flipped the layer above its anchor. The flip swaps the block margins, so the old margin moved the list further down.

Now the open listbox's resize report runs the same measurement and commits before the frame paints. At the open, the overlay keeps main's margin, so the layer opens below its anchor, where the runtime caps it above a keyboard. A layer the browser flips while the list is open keeps that side. Its margin keeps the same clamped top, or lifts the list's end above a keyboard, as far as the top gutter allows.

A list at its height cap does not resize when an option grows, so there the row still moves, as on main.

Expected behavior and authority

component:Selector FR2: "a non-search popover aligns the selected row over the trigger and clamps it to the viewport, above any software keyboard". architecture:layer-runtime: "Every anchored placement can flip across either axis", so the layer keeps its fallbacks.

Smallest restoration

  • Selector/hooks.ts: one resize observation of the open listbox, and the margin for a flipped layer.
  • The flip is read with getPropertyValue('position-area'), empty without anchor positioning.
  • Main's observeResizeAfterLayout observes the listbox. No other subscriber of that shared observer watches it.

Evidence

  • Before: on main, both growth proofs fail in Chromium (3 of 3) and in WebKit (3 of 3). The row stayed 63 px off the trigger in every painted frame. The near-end list ended at 824 px in a 720 px viewport.
  • After: all three proofs pass 5 of 5 in each engine. No painted frame is over 2 px off, and the near-end list ends at the gutter.
  • Beside a software keyboard: Testing items 8 and 9. Unchanged paths: items 3 to 5.
  • Regression tests: two browser specs in both engines, five SelectorKeyboardInset cases, and a Selector.test.tsx case.

Scope

Components: Selector

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

Gates at f8934508dd, on main 694962babf, unless an item names another head. This head adds only the record line, where pnpm check:knowledge passes.

  1. In Storybook, open Selector › Pre Selected and open the list. Then run document.querySelector('[role="option"]').style.minHeight = '96px': the selected row stays on the trigger.
  2. At 5f7cd6d751, SelectorOverlayGrowth.a11y.browser.spec.ts, 5 runs: all three proofs pass in Chromium and in WebKit (CI's container, 1 worker). With main's hooks.ts, both growth proofs fail 3 of 3 in each engine. Here this pull request's three specs pass in both engines, 22 tests each.
  3. pnpm exec vitest run --project ui: 25,954 tests pass in 1,043 files. Main's unit case for an already flipped layer put the 16 px gutter in the block-start margin and expected the overlay 16 px higher. Its layer's position-area still named the side below the anchor, a pair a flip never produces: it moves both together. The case now mocks the flipped position-area too, and still expects the overlay 16 px higher, so no behavior is dropped.
  4. Selector's accessibility specs in Chromium, the keyboard inset spec included: 90 pass. At ce0df873f1, CI's accessibility runner, on the 38 specs its dry run routes for this change: 236 tests pass.
  5. The eight interaction specs that open a Selector story cover Layer entrance, keyboard caps, pans, presses and hit areas. At CI's profile, Chromium 83 pass, WebKit 61 pass, and the rest skip by engine.
  6. Strict ESLint and core tsc give 0 errors. pnpm check:knowledge and changeset coverage pass, and pnpm review:pre has 0 findings.
  7. f8934508dd merges main 694962babf. This pull request's own diff is byte-identical to 5f7cd6d751's. The device set in item 9 ran at this head.
  8. SelectorKeyboardInset's two new cases fix the field 8 px above the viewport's end, beside its 300 px stand-in keyboard. At 448aed5eed the list ended at 692–828 px, under the keyboard's line at 534 px, 3 of 3 in each engine. Here and on main both pass 3 of 3 in each engine. Two more open the nine-option story at 844×390, its field 8 px from the end, beside a 200 px keyboard. At 051a2f366f the list stayed at 54–350 px, under the keyboard's line at 180 px, 3 of 3 in each engine. Here it shrinks into the room from 0 to 180 px, fills it to within a row, and scrolls, 3 of 3 in each engine. Main's hooks.ts, run with this story, passes too. A fifth case fixes the field 8 px from the end at 390×844. A grown option flips the list, the keyboard rises, and another option grows. At 4db8f6acb5 the list stopped at 270–558 px, past the line at 534 px, 3 of 3 in each engine. Here it passes 3 of 3 in each engine. With main's hooks.ts the list runs off screen, at 1042–1242 px, 3 of 3 in each engine. The spec's .chromium.spec.ts name keeps it to Chromium in CI. WebKit ran an untracked copy of it, renamed to .browser.spec.ts and otherwise identical.
  9. Selector › Flipped Overlay Beside Keyboard follows main's Overlay Beside Keyboard layout, with nine options. SelectorFlippedOverlayKeyboard.a11y.browser.spec.ts fixes the field 300 px above the viewport's end itself. It then opens the story beside a 291 px stand-in keyboard. The list must end above the keyboard at its height without one. At 448aed5eed it was 258 px tall instead of 296. A first version of this fix squeezed it to 30 px, one row, which the browser spec pins. Here and on main it passes 3 of 3 in each engine. With a 336 px keyboard the list also keeps its height, 3 of 3 in each engine. This pull request adds the story, so its runs at older heads and on main pair their hooks.ts with it.
    • At this head and on main 694962babf, an Android 16 emulator (Chrome 133, Gboard) ran each check, as spec:AST-094 DEC-27 asks (test data). Each ran at normal speed, with the CPU slowed 4×, and with animations removed and Reduce Motion on. Between runs the rig reset the keyboard, the same at both builds.
    • In main's Overlay Beside Keyboard story with the keyboard up, the list opened at 192.2–405.0 px, or 189.2–413.2 px with animations removed. The keyboard's top sat at 423.2 px, and both builds matched in every run.
    • Without the keyboard it opened at 253–477 px, six options with no scroll, on both builds.
    • In this pull request's story, from the keyboard up, the list opened upward at 113.2–413.2 px, nine options that scroll.
    • Android landscape with the keyboard up not evidenced: the emulator scene leaves 67 px visible and 40 px of scroll, so the case can't be set up; the same at main
    • On an iPhone 14 (iOS 26.2, Safari) at this head, the list opened 19 of 19 times. Its "Apple" row sat at 206 pt with the keyboard up, in 10 runs, and at 304 pt without it, in 9.
  10. Each open still measures twice: in the layout effect, and at the browser's first resize report. That report comes after layout, so it catches a size change between the two.
  11. At cc7bc2e033, an engine without anchor positioning crashed on open (3 of 3), and each open warned about flushSync. The growth spec's no-anchor proof and a Selector.test.tsx case now cover both.

A list the browser flips above its trigger while open can sit partly under a keyboard that rises later. That happens when the list is taller than the room above it. Issue #11725 tracks a cap on the flipped list's block size.

One full Chromium run saw a growth proof's painted frame 2.12 px off (bound 2). The cases had changed the list while its entrance animations still ran. The spec now waits for them to end. After that: Chromium ×20, 60 of 60; WebKit ×10, 30 of 30; the full Selector accessibility run twice, 69 of 69.

This branch's first version, a layer with no fallbacks plus two record edits, is gone under the layer runtime's flip rule. Main's end gutter now covers its first case. Two of its proofs are dropped:

  • "a list wider than its trigger stays inside the inline-end gutter": the viewport inset keeps that gutter on the far edge only. Main keeps the list inside the viewport.
  • "the overlay list ends above the software keyboard": it asserted a cap model, and main's FR2 slides the list above the keyboard instead.

Writing rubric results

R1 narration: none; the added line states the gap in the present tense.
R2 research: none in the record.
R3 evidence: the line records an evidence gap under spec:AST-094 DEC-27.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none touched.
R7 project status: none.

Public and internal API delta

  • Public: none.
  • Internal: none. useSelectedItemOverlayMargin keeps its options and return.
  • Size: +826/−20 lines (694962babf..83c44150d1), in 8 files: source +80/−14, tests +694/−5, story +44, changeset +7, record +1/−1.
  • Component size: Selector's eager import +245 B gzip (116,018 to 116,263), and its CSS +0 B. The repository's component size report (analyze-pr.js) measured both at ce0df873f1 against main 120629d82a. The growth is default behavior, so architecture:component-import-boundaries INV10's optional-feature budget does not apply (DEC-5).

vjeux added 8 commits November 4, 2026 00:46
…s close

placeLayerExitCopy puts a static, inert copy of a closing layer where the
layer was drawn, in the top layer, for a touch presentation's close to play
on: the browser hides a popover the moment it closes. The copy keeps the
layer's box, transform, presented look, overflow and scroll positions; has
no ids, anchor names, form names or form owner; is inert and hidden from assistive
technology; and its descendants' keyframe animations and transitions do not
start again. A refused show during the closing toggle waits, hidden, until
the toggle is over. A layer inside other layers gets its copy after the
outermost one, with what it inherited there (its color scheme included),
so a close that takes the layers around it too still draws the copy. That
copy is shown again above the copy the same close then places for a layer
around it. A layer has one copy. The layer-runtime record states
it, and that the presentation plays its exit on the copy (AST-094 FR7).

Core's shared inertCopy now takes every copied native control and
form-associated custom element out of any form with form="", as its
documentation says, so the swap's copies join no form either. It also
sets anchor-name: none on each copied element that has an anchor name, so
no live anchor gets a second element.
…av (spec:AST-094 FR35)

Layer/inputHold holds a layer's pointer input while its presentation
enters or leaves. holdInput(layer, {until, scope}) raises a shield:
'viewport' over the whole viewport while a modal layer enters; 'surface'
over the layer's own box while a non-modal one enters, the page around it
live; 'layer' over the viewport, its content inert, while a layer leaves.
It decides by each event's pointer (a finger's or a pen's press is held to
its end; a mouse passes once it moves with no button down, or from the
start when the page last heard a mouse, DEC-16), never cancels a touch's
start, and cancels a one-finger move so a pinch still zooms (FR10). It
hears input through Core's shared input stream before every other
subscriber, and ends the dispatch for a held event, so press feedback and the
gesture host never hear it; the stream gains first subscribers and records
the type of the latest pointer event it delivers (getLastPointerType). The gesture
host asks the hold for each touch (holdsTouch), so the hold imports nothing
from gestures/ and a component in the root entry may use it statically
(architecture:react-component-runtime INV13).

Its first users hold only under a coarse primary pointer, a touch
presentation (FR13): Dialog, Drawer and MobileNav hold a finger's tap or
drag while they enter (holdEntranceInput, which reads the entrance's own
animations; MobileNav's slide-in is capped at 550 ms), a non-modal Drawer
only on its panel. Under a fine primary pointer nothing is held and
nothing listens (FR24). Where the primary pointer is fine and the screen
also takes touch, a finger is not held yet; AST-094's current-state impact
and Drawer's record name that gap. AST-094's current-state impact also
names the first press of a still mouse after a finger, which lands on an
entering presentation's shield. AlertDialog renders Dialog, so its
entrance is held too: its record says FR7 ships in part, the leaving
alert's inert content waiting for FR6's dismissal.

Every browser proof lands its input at an exact point (an entrance held
where it is, the page's clock, or an exact step of a drag) and plays once.

The WebKit interaction lane's scope includes Layer/inputHold.ts: the
gesture host imports it, so the gesture specs' fixture bundles it.

MobileNav's record states what the rest of the slide-out after the close
does: it is inert, taking no input and hidden from assistive technology
(FR5). A browser case proves both against the open drawer.

From meta#8342 and its per-event offer, meta#8630 (Dialog and Drawer) and meta#8374
(MobileNav).

Co-authored-by: Cindy Zhang <[email protected]>
…s back into it

Under a coarse primary pointer, Popover grows out of its trigger on the
theme's entrance duration and easing and shrinks back into it on the
theme's exit duration and easing, on the layer runtime's exit copy. A fine
primary pointer keeps the layer's own entrance.
…rink

Real-browser proofs, in Chromium and WebKit, that under a finger Popover
grows out of its trigger on the theme's entrance tokens and shrinks back on
its exit tokens, keeps advancing through a blocked main thread, does no
Layout or Paint per frame, and cross-fades under Reduce Motion, with
storyboards of both.
…d, as on iOS

While the popover grows out of its trigger under a coarse primary pointer,
the layer runtime's input hold takes every touch. A tap outside neither
dismisses it nor reaches what is under it, a pan scrolls nothing, and a
pinch still zooms the page.
Opening a popover under a finger ran the touch presentation in the
opening task. The animator's style writes and the box reads laid the
anchored page out more often than a mouse opening does, and on a
loaded machine that task could pass the 50 ms long-task line.

The opening task now reads and writes nothing while it runs. As it
ends, after its own reads, the layer's CSS entrance goes off, a write
that costs it no layout. A style read after that task then starts no
entrance. The presentation waits for the next animation frame, which
runs before it paints. There it puts the element invisible at its
full size, reads the boxes, starts the curves and takes the input
hold. A close before that frame cancels it and leaves the element as
the component styles it, with no compositing layer. A presentation
again during a dismissal still starts at once, since it reads
nothing. Without animation frames, the presentation runs at once and
a close plays the shrink.

Popover's record notes, under Current-state impact, that the input
hold starts on the first frame after the open, so a touch landing
within that frame reaches the page.
…s close

placeLayerExitCopy puts a static, inert copy of a closing layer where the
layer was drawn, in the top layer, for a touch presentation's close to play
on: the browser hides a popover the moment it closes. The copy keeps the
layer's box, transform, presented look, overflow and scroll positions; has
no ids, anchor names, form names or form owner; is inert and hidden from assistive
technology; and its descendants' keyframe animations and transitions do not
start again. A refused show during the closing toggle waits, hidden, until
the toggle is over. A layer inside other layers gets its copy after the
outermost one, with what it inherited there (its color scheme included),
so a close that takes the layers around it too still draws the copy. That
copy is shown again above the copy the same close then places for a layer
around it. A layer has one copy. The layer-runtime record states
it, and that the presentation plays its exit on the copy (AST-094 FR7).

Core's shared inertCopy now takes every copied native control and
form-associated custom element out of any form with form="", as its
documentation says, so the swap's copies join no form either. It also
sets anchor-name: none on each copied element that has an anchor name, so
no live anchor gets a second element.
@vercel

vercel Bot commented Nov 5, 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 Nov 17, 2026 8:38am UTC

Request Review

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

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 8:53 AM UTC

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 83c4415

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Selector 113.6 kB (+244 B) · 18.7 kB CSS (0) — ✗ · ✓ · ✓
SelectorOption 24.1 kB (0) · 6.7 kB CSS (0) — ✗ · ✓ · ✓
richtext/RichTextEditorToolbar 300.4 kB (+247 B) · 454 B CSS (0) — — · — · —
3 more components
Component Size LoC Visual · A11y · RTL
PowerSearch 307.5 kB (+242 B) · 25.6 kB CSS (0) — — · — · —
Pagination 124.5 kB (+208 B) · 19.1 kB CSS (0) — — · — · —
CommandPalette 78.1 kB (+5 B) · 12.8 kB CSS (0) — — · — · —
Visual changes: 4 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
Selector · Indicator Space Bottom Sheet Wide Start (neutral, dark) · inheritance unknown: not found in the 4 newest reports of other pull requests before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Wide Start (neutral, light) · inheritance unknown: not found in the 4 newest reports of other pull requests before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Narrow End RTL (neutral, dark) · inheritance unknown: not found in the 4 newest reports of other pull requests before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Narrow End RTL (neutral, light) · inheritance unknown: not found in the 4 newest reports of other pull requests before frame after frame diff frame

Inheritance checked against the 4 newest reports of other pull requests.

Package size: @astryxdesign/core 7.63 MB packed (+1.5 kB); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 62e9bc7

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because the pull request is a draft from a fork. Once it is marked ready for review, a maintainer adds the ci:run label so CI runs.

The translate-based clamp keeps the whole list inside the viewport (544–720px instead of 700–876px in a 720px window), and the mid-viewport overlay and the public API are unchanged. Non-blocking suggestions:

  • In SelectorOverlayViewport.a11y.chromium.spec.ts, assert the clamped position (list bottom at 720) as well as the bounds, so a shift that ignored the flip would fail the spec.
  • The clamp still uses the raw viewport edges, as it already did at the top. A follow-up could keep the layer runtime's gutter and any LayerProvider inset at both edges.
  • Two new source comments run long. Inline suggestions trim them to the reason alone.

[Automated review]

Comment thread packages/core/src/Selector/Selector.tsx Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The translate-based clamp keeps the whole list inside the viewport when a default Selector opens at the bottom of the window (544–720px instead of 700–876px in a 720px window), but the shift goes stale when the list later moves to the other side of the trigger.

  • Miss: after the viewport shrinks with the list open (Pre Selected opened at 720px, window shrunk to 330px), the layer flips above the trigger while the measured translate: 0 -69px stays, so the list moves to −44–92px and the selected row sits 143px above the trigger, where main keeps it over the trigger; re-measuring the shift on viewport resize (hooks.ts:159-161) and adding a Chromium case that shrinks the viewport with the list open would fix it.

Non-blocking: two new comments run long (inline suggestions), and the clamp still ignores the runtime's 16px viewport gutter, as it already did at the top edge. CI has not run on this draft head yet.

[Automated review]

Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/Selector.tsx Resolved

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The translate-based clamp keeps the whole list inside the viewport when a default Selector opens at the bottom of the window (544–720px instead of 700–876px in a 720px window), and the shift now follows a viewport resize, but one change of side is still missed.

  • Miss: when the trigger moves on screen without resizing while the list is open (220px of content added above it), the layer flips above the trigger but keeps translate: 0 -89px, so the selected row sits about 209px above the trigger where main keeps it over the trigger; re-measuring on every change that re-settles the layer, by subscribing through the layer runtime's own observer in useLayer.tsx (observeAnchorClearance, which already follows same-size anchor moves with observeMove) instead of the partial observer set at hooks.ts:129-141, plus a Chromium case that moves the trigger in layout with the list open, would fix it.

Non-blocking: three new comments could be tightened (inline suggestions). CI has not run on this draft head yet.

[Automated review]

Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The translate-based clamp keeps the whole list inside the viewport when a default Selector opens at the bottom of the window (544–720px instead of 700–876px in a 720px window), and the list follows a viewport resize and a same-size trigger move, but a page scroll still throws it off.

  • Scrolling the page with the list open re-measures the shift from the offsetTop chain (hooks.ts:205), which leaves out the scroll adjustment anchor positioning applies, so a 150px wheel scroll moves translate from 0 -69px to 0 -219px and leaves the selected row about 150px above its trigger; reading the laid-out top from the popover's box with only its own translate and transform undone (as untransform in useLayer.tsx does), plus a Chromium case that scrolls the page with the list open, would fix it.

Non-blocking: the fourth Chromium case's title says more than it tests. CI has not run on this draft head yet.

[Automated review]

Comment thread packages/core/src/Selector/hooks.ts Resolved
cixzhang and others added 2 commits November 5, 2026 07:36
…s back into it

Under a coarse primary pointer, Popover grows out of its trigger on the
theme duration step nearest iOS's growth (`--duration-medium-min`) and the
theme's entrance easing, and shrinks back into it on the theme's exit
duration and easing, on the layer runtime's exit copy. A fine primary
pointer keeps the layer's own entrance.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 5f7cd6d

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because every CI job skips a draft; it runs once the pull request is marked ready for review, and it must pass before merge.

The latest push only merges main, and the fix holds after it. In Pre Selected, a first option grown to 96 px leaves the selected row 63 px off the trigger on main and 1 px off here; near the viewport's end the grown list stops at the 16 px gutter instead of running to 824 px in a 720 px viewport, and all 77 Selector browser tests pass in Chromium. The phone results in the description were taken before this merge, which changes the shared Layer/useLayer.tsx, so they do not carry to this head; no requirement this change touches asks for them.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (1): "Whatever the scope, these are computed over the whole pull request" (re-review rule counting). Checked: the recipe change and this review's mode; no finding.
  • Changeset: an option that grows while an open list is shorter than its height cap keeps the selected row on the trigger. Verified: 63 px off on main, 1 px here; the growth proof fails on main and passes here.
  • Changeset: the overlay measured only when the list opened, so a grown row left the trigger and a list near the viewport's end grew past it. Verified on main: 63 px off; the list runs to 824 px in a 720 px viewport.
  • Changeset: the overlay measures again when the open list resizes, before that frame paints. Verified in code (hooks.ts:266-276) and by the painted-frame proof.
  • Changeset and description: no public or internal API change; the overlay hook keeps its options and return. Verified: the built Core, build and theme surfaces compare with 0 rows changed.
  • Description: mid-viewport, a grown first option leaves the row 63 px off; near the end the grown list runs past the viewport and its last options cannot be reached. Verified on main.
  • Description: near the end the browser flips the grown list, and the swapped margin moves it further down. Verified on main: the flipped list sits at 624–824 px.
  • Description: the list's resize report runs the same measurement and commits before paint. Verified.
  • Description: at the open the overlay keeps main's margin, so the layer opens below its anchor, where the runtime caps it above a keyboard. Verified in code (hooks.ts:309-318) and by the keyboard cases.
  • Description: a layer flipped while open keeps that side, and its margin keeps the clamped top or lifts the list's end above a keyboard, as far as the top gutter allows. Verified: the near-end list ends at 704 px, and the flip-then-grow keyboard case passes.
  • Description: a list at its height cap does not resize, so its row still moves, as on main. Verified in code: only the list's own box is observed.
  • Description: the quoted Selector and layer-runtime requirements. Verified against the current records.
  • Description: the flip is read from the computed position area, which is empty without anchor positioning. Verified in code (hooks.ts:150-156) and by the no-anchor proof.
  • Description: no other subscriber of the shared resize observer watches the list. Verified: the layer runtime observes the anchor, and its own clearance observer serves only layers that keep their anchor clear.
  • Description: both growth proofs fail on main and all three pass here, in Chromium and WebKit. Verified in Chromium at this head; WebKit was not run in this review.
  • Description: two browser specs, five keyboard-inset cases and a unit case. Present; all pass here in Chromium.
  • Description: the gates and the full unit, accessibility-runner and interaction counts ran at earlier commits. Not reproduced in full; Selector's unit file (252 tests) and all 77 Selector browser tests pass at this head.
  • Description: strict ESLint and core TypeScript give 0 errors, and the knowledge, changeset and pre-review checks pass. Core's TypeScript build passes at this head; the other checks were not re-run, and the changed files are identical to the last reviewed revision.
  • Description: the earlier merge's import-graph notes, and the previous merge of main changing none of this pull request's files. The merge claim holds, and the latest merge also changes none of its files; the import-graph notes were not reproduced.
  • Description: the near-end, flip-then-grow and landscape keyboard cases. Verified in Chromium at this head; on main the flip-then-grow list runs to 1042–1242 px, as stated; earlier-commit numbers are taken from the description.
  • Description item 9: the phone story follows Overlay Beside Keyboard's layout with nine options, and its spec pins the field 300 px above the end and keeps the list at full height beside a 291 px keyboard. Verified in the story, the spec and its Chromium run.
  • Description item 9: the Android emulator and iPhone results, left pending under the evidence-carry rule. Taken from the description; they were recorded before this merge, which changes a shared layer module, so they do not carry to this head; no requirement this change touches asks for them.
  • Description: each open measures twice. Verified in code.
  • Description: an engine without anchor positioning no longer crashes, and no open warns about a flush. Verified by the no-anchor proof and the unit case.
  • Description: a flipped list taller than the room above a later keyboard can sit under it, and a landscape pan problem, each tracked in an open issue. Verified: both issues are open.
  • Description: the growth spec waits for entrance animations to end. Verified.
  • Description: the first version's two dropped proofs. Consistent with the code: neither remains.
  • Description: +825/−19 lines in 7 files (source +80/−14, tests +694/−5, story +44, changeset +7). Verified.
  • Description: Selector's eager import grows by 258 B gzip as default behavior, outside the optional-feature budget. Not re-measured; the shipped code is unchanged since it was measured, and the budget covers only optional features.
  • Story doc: the trigger sits where Overlay Beside Keyboard's does, and nine options make the list rise above a keyboard. Verified in the story's code.
  • packages/core/src/Selector/hooks.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorOverlayGrowth.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorKeyboardInset.a11y.chromium.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorFlippedOverlayKeyboard.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/Selector.test.tsx: clear.
  • apps/storybook/stories/Selector.stories.tsx: clear.
  • .changeset/selector-overlay-growth.md: clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec ce0df87

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because every CI job skips a draft; it runs once the pull request is marked ready for review, and it must pass before merge.

The latest push only merges main, and the fix holds after it. In Pre Selected, a first option grown to 96 px leaves the selected row 63 px off the trigger on the base and 1 px off here; near the viewport's end the grown list stops at the 16 px gutter instead of running to 824 px in a 720 px viewport, and all 90 Selector browser tests pass in Chromium. The phone results in the description were taken before this merge, which changes the shared Layer/useLayer.tsx, so they do not carry to this head; no requirement this change touches asks for them.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none.
  • Changeset: when an option grows while an open list is shorter than its height cap, the selected row stays on the trigger. Verified: 63 px off on the base, 1 px here; the growth proof fails on the base and passes here.
  • Changeset: the overlay measured only when the list opened, so a grown row left the trigger and a list near the viewport's end grew past it. Verified on the base: 63 px off; the list runs to 824 px in a 720 px viewport.
  • Changeset and description: the overlay measures again when the open list resizes, before that frame paints, with no API change, and the internal overlay hook keeps its options and return. Verified in code (hooks.ts:250-342), by the painted-frame proof, and by the API surface comparison (0 rows).
  • Description: mid-viewport a grown first option leaves the row 63 px off; near the end the grown list runs past the viewport and its last options cannot be reached. Verified on the base.
  • Description: near the end the browser flips the grown list, and the swapped margin moves it further down. Verified on the base: the flipped list sits at 624–824 px.
  • Description: the list's resize report runs the same measurement and commits before paint. Verified.
  • Description: at the open the overlay keeps the base's margin, so the layer opens below its anchor, where the keyboard cap applies; a layer flipped while open keeps that side, its top at the clamped top or its end above a keyboard, below the top gutter. Verified in code (hooks.ts:301-318) and by the keyboard cases.
  • Description: a list at its height cap does not resize, so its row still moves as before. Verified in code: only the list's own box is observed.
  • Description: the quoted Selector and layer-runtime requirements. Verified against the current records.
  • Description: the flip is read from the computed position area, which is empty without anchor positioning. Verified in code (hooks.ts:153-156) and by the no-anchor proof.
  • Description: no other subscriber of the shared resize observer watches the list. Verified: the layer runtime observes the anchor.
  • Description: both growth proofs fail on the base and all three pass here, in Chromium and WebKit. Verified in Chromium at this head; WebKit was not run.
  • Description: two browser specs, five keyboard-inset cases and a unit case. Present; all pass here in Chromium.
  • Description: the existing unit case for an already flipped layer now also mocks the flipped position area and keeps its expectation. Verified in Selector.test.tsx:648-681; it passes.
  • Description: the full unit, accessibility-runner and interaction counts, the lint, type, knowledge, changeset and pre-review gates, and the import-graph notes, all from an earlier commit. Not reproduced in full; Selector's unit file (261 tests), all 90 Selector browser specs and Core's TypeScript build pass at this head.
  • Description: the near-end, flip-then-grow and landscape keyboard cases, and the phone story whose spec pins the field 300 px above the end and keeps the list at full height beside a 291 px keyboard. Verified in Chromium at this head; on the base the flip-then-grow list runs to 1042–1242 px, as stated.
  • Description: the Android emulator and iPhone results. Taken from the description; they were recorded before this merge, which changes a shared layer module, so they do not carry to this head, and no requirement this change touches asks for them.
  • Description: each open measures twice. Verified in code.
  • Description: an engine without anchor positioning no longer crashes, and no open warns about a flush. Verified by the no-anchor proof and the unit case.
  • Description: a flipped list taller than the room above a later keyboard can sit under it, tracked in an open issue. Verified: the issue is open.
  • Description: the growth spec waits for entrance animations to end, and the first version's two proofs are gone. Verified.
  • Description: +825/−19 lines in 7 files (source +80/−14, tests +694/−5, story +44, changeset +7). Verified.
  • Description: Selector's eager import grows by 265 B gzip as default behavior, outside the optional-feature budget. Not re-measured; the shipped code is unchanged since it was measured, and the size rule places default behavior outside it.
  • Story doc: nine options, the trigger where Overlay Beside Keyboard's sits, and the list ends above the keyboard. Verified in the story's code and its spec run.
  • packages/core/src/Selector/hooks.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorOverlayGrowth.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorKeyboardInset.a11y.chromium.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorFlippedOverlayKeyboard.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/Selector.test.tsx: clear.
  • apps/storybook/stories/Selector.stories.tsx: clear.
  • .changeset/selector-overlay-growth.md: clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec f893450

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because every CI job skips a draft; it runs once the pull request is marked ready for review, and it must pass before merge.

The latest push only merges main, which changes none of this pull request's files, so the earlier approval carries forward with the patch unchanged. In Pre Selected, a first option grown to 96 px leaves the selected row 63 px off the trigger on the base and 1 px off here; near the viewport's end the grown list stops at the 16 px gutter instead of running to 824 px in a 720 px viewport, and all 90 Selector browser tests pass in Chromium. The phone results in the description were taken before the merges of main that change the shared Layer/useLayer.tsx, so they do not carry to this head; no requirement this change touches asks for them.

Claims and files checked

Review mode: carry-forward; reason: none

  • Changeset: when an option grows while an open list is shorter than its height cap, the selected row stays on the trigger. Verified: 63 px off on the base, 1 px here; the growth proof fails on the base and passes here.
  • Changeset: the overlay measured only when the list opened, so a grown row left the trigger and a list near the viewport's end grew past it. Verified on the base: 63 px off; the list runs to 824 px in a 720 px viewport.
  • Changeset and description: the overlay measures again when the open list resizes, before that frame paints, with no API change, and the internal overlay hook keeps its options and return. Verified in code (hooks.ts:250-342), by the painted-frame proof, and by the API surface comparison (0 rows).
  • Description: mid-viewport a grown first option leaves the row 63 px off; near the end the grown list runs past the viewport and its last options cannot be reached. Verified on the base.
  • Description: near the end the browser flips the grown list, and the swapped margin moves it further down. Verified on the base: the flipped list sits at 624–824 px.
  • Description: the list's resize report runs the same measurement and commits before paint. Verified.
  • Description: at the open the overlay keeps the base's margin, so the layer opens below its anchor, where the keyboard cap applies; a layer flipped while open keeps that side, its top at the clamped top or its end above a keyboard, below the top gutter. Verified in code (hooks.ts:301-318) and by the keyboard cases.
  • Description: a list at its height cap does not resize, so its row still moves as before. Verified in code: only the list's own box is observed.
  • Description: the quoted Selector and layer-runtime requirements. Verified against the current records.
  • Description: the flip is read from the computed position area, which is empty without anchor positioning. Verified in code (hooks.ts:153-156) and by the no-anchor proof.
  • Description: no other subscriber of the shared resize observer watches the list. Verified: the layer runtime observes the anchor.
  • Description: both growth proofs fail on the base and all three pass here, in Chromium and WebKit. Verified in Chromium with this patch; WebKit was not run.
  • Description: two browser specs, five keyboard-inset cases and a unit case. Present; all pass here in Chromium.
  • Description: the existing unit case for an already flipped layer now also mocks the flipped position area and keeps its expectation. Verified in Selector.test.tsx:648-681; it passes.
  • Description: the full unit, accessibility-runner and interaction counts, the lint, type, knowledge, changeset and pre-review gates, and the import-graph notes, all from an earlier commit. Not reproduced in full; Selector's unit file (261 tests), all 90 Selector browser specs and Core's TypeScript build pass with this patch.
  • Description: the near-end, flip-then-grow and landscape keyboard cases, and the phone story whose spec pins the field 300 px above the end and keeps the list at full height beside a 291 px keyboard. Verified in Chromium with this patch; on the base the flip-then-grow list runs to 1042–1242 px, as stated.
  • Description: the Android emulator and iPhone results. Taken from the description; they were recorded before merges of main that change a shared layer module, so they do not carry to this head, and no requirement this change touches asks for them.
  • Description: each open measures twice. Verified in code.
  • Description: an engine without anchor positioning no longer crashes, and no open warns about a flush. Verified by the no-anchor proof and the unit case.
  • Description: a flipped list taller than the room above a later keyboard can sit under it, tracked in an open issue. Verified: the issue is open.
  • Description: the growth spec waits for entrance animations to end, and the first version's two proofs are gone. Verified.
  • Description: +825/−19 lines in 7 files (source +80/−14, tests +694/−5, story +44, changeset +7). Verified.
  • Description: Selector's eager import grows by 265 B gzip as default behavior, outside the optional-feature budget. Not re-measured; the shipped code is unchanged since it was measured, and the size rule places default behavior outside it.
  • Story doc: nine options, the trigger where Overlay Beside Keyboard's sits, and the list ends above the keyboard. Verified in the story's code and its spec run.
  • packages/core/src/Selector/hooks.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorOverlayGrowth.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorKeyboardInset.a11y.chromium.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorFlippedOverlayKeyboard.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/Selector.test.tsx: clear.
  • apps/storybook/stories/Selector.stories.tsx: clear.
  • .changeset/selector-overlay-growth.md: clear.

Automated review (maintainer link)

FR2's verification row now names the case no emulator scene can set
up: Android landscape with the keyboard up leaves 67 px visible and
40 px of scroll, at this head and on main alike.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 83c4415

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because every CI job skips a draft; it runs once the pull request is marked ready for review, and it must pass before merge.

In Pre Selected, a first option grown to 96 px leaves the selected row 63 px off the trigger on the base and 1 px off here, and near the viewport's end the grown list stops at the 16 px gutter instead of running to 824 px in a 720 px viewport. All 90 Selector browser tests pass in Chromium, and the new growth and keyboard proofs fail against the base. Two small text fixes are worth making before merge:

  • The new FR2 verification row ends "; the same at main", which describes this branch rather than the system and reads wrongly once merged, and the description lacks the ## Writing rubric results section the contribution guide asks of a pull request that changes a record.
  • Testing item 9 still says the Android landscape check is pending a fix to its test, while the new record row says the emulator scene cannot set that case up, so the two should agree.
Claims and files checked

Review mode: full; reason: spec-record

  • Changeset: when an option grows while the open list is under its height cap, the selected row stays on the trigger. Verified: 63 px off on the base, 1 px here; the growth proof fails on the base and passes here.
  • Changeset: the overlay measured only at the open, so a grown row left the trigger and a list near the viewport's end grew past it. Verified on the base: 63 px off; the grown list runs to 824 px in a 720 px viewport.
  • Changeset and description: the overlay measures again when the open list resizes, before that frame paints, with no public or internal API change. Verified in the hook's code, by the painted-frame proof (no frame over 2 px off), and by the API surface comparison (0 rows).
  • Description: mid-viewport a grown first option leaves the row 63 px off; near the end the grown list runs past the viewport and its last options cannot be reached. Verified on the base.
  • Description: near the end the browser flips the grown list, and the swapped margin moves it further down. Verified on the base: the flipped list sits at 624–824 px.
  • Description: at the open the overlay keeps the base's margin, so the layer opens below its anchor; a layer flipped while open keeps that side, its top at the clamped top or its end above a keyboard, below the top gutter. Verified in code and by the keyboard cases.
  • Description: a list at its height cap does not resize, so its row still moves as before. Verified in code: only the list's own box is observed.
  • Description: the quoted Selector and layer-runtime requirements. Verified against the current records.
  • Description: the flip is read from the computed position area, which is empty without anchor positioning. Verified in code and by the no-anchor proof.
  • Description: no other subscriber of the shared resize observer watches the list. Verified: the layer runtime observes the anchor.
  • Description: both growth proofs fail on the base and all three pass here, in Chromium and WebKit. Verified in Chromium; WebKit was not run.
  • Description: two browser specs, five keyboard-inset cases and a unit case. Present; all pass here in Chromium.
  • Description: the existing unit case for an already flipped layer now also mocks the flipped position area and keeps its expectation. Verified; it passes with the base's hook and this one.
  • Description: the full unit, accessibility-runner and interaction counts and the lint, type, knowledge, changeset and pre-review gates, taken at an earlier commit. Not reproduced in full; Selector's unit file (261 tests), all 90 Selector browser specs, the knowledge check and Core's build pass at this head.
  • Description: the merges of main change none of this pull request's files, and the import-graph notes. The first is verified; the import-graph detail was not reproduced.
  • Description: the near-end, flip-then-grow and landscape keyboard cases, and the phone story whose spec keeps the list at full height beside a 291 px keyboard. Verified in Chromium; on the base the flip-then-grow list runs to 1,042–1,242 px, as stated.
  • Description: the Android emulator and iPhone results. Taken from the description; they were recorded before a merge of main that changes a shared layer module, so they do not carry to this head, and no requirement this change touches asks for them. The landscape line disagrees with the new record row (non-blocking note above).
  • Description: each open measures twice. Verified in code.
  • Description: an engine without anchor positioning no longer crashes, and no open warns about a flush. Verified by the no-anchor proof and the unit case.
  • Description: a flipped list taller than the room above a later keyboard can sit under it, tracked in an open issue. Verified: the issue is open.
  • Description: the growth spec waits for entrance animations to end, and the first version's two proofs are gone. Verified.
  • Description: the line counts, measured over an earlier range. Accurate for that range; at this head the change is 826 added and 20 deleted lines in 8 files, the record line included.
  • Description: Selector's eager import grows by 265 B gzip as default behavior. Consistent: a page that renders only Selector grows by 268 B gzip here, and the four reference pages do not change.
  • Story doc: nine options, the trigger where Overlay Beside Keyboard's sits, and the list ends above the keyboard. Verified in the story's code and its spec run.
  • Record: Android landscape with the keyboard up is not evidenced, because the emulator scene cannot set it up. Taken from the pull request's text (emulator evidence).
  • packages/core/src/Selector/hooks.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorOverlayGrowth.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorKeyboardInset.a11y.chromium.spec.ts: clear.
  • packages/core/src/Selector/__tests__/SelectorFlippedOverlayKeyboard.a11y.browser.spec.ts: clear.
  • packages/core/src/Selector/Selector.test.tsx: clear.
  • apps/storybook/stories/Selector.stories.tsx: clear.
  • docs/specs/components/Selector/Selector.spec.md: non-blocking wording note.
  • .changeset/selector-overlay-growth.md: clear.

Automated review (maintainer link)

| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| FR1, AR2, AR3 | `Selector.test.tsx` selection, focus, and keyboard suites, including "leaves focus on the field a press moved it to" and "returns focus to the trigger when the press lands on nothing focusable" | closed/open, search/non-search, disabled option | Removing selection wiring, focus movement, or keyboard behavior fails the named interaction tests | `audit:Selector/behavior` |
| FR2 | placement and selected-item geometry tests; `SelectorKeyboardInset.a11y.chromium.spec.ts` | default, explicit, RTL, transformed entry, keyboard up | Using the wrong positioning model fails the expected position-area or margin | `audit:Selector/behavior` |
| FR2 | placement and selected-item geometry tests; `SelectorKeyboardInset.a11y.chromium.spec.ts`; Android landscape with the keyboard up not evidenced: the emulator scene leaves 67 px visible and 40 px of scroll, so the case can't be set up; the same at main | default, explicit, RTL, transformed entry, keyboard up | Using the wrong positioning model fails the expected position-area or margin | `audit:Selector/behavior` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: "; the same at main" describes this branch, not the system, and reads wrongly once the change is on main. Suggested ending for the cell: Android landscape with the keyboard up is not evidenced: the emulator scene leaves 67 px visible and 40 px of scroll, so the case cannot be set up. The description also needs its ## Writing rubric results section for this record edit.

@cixzhang cixzhang added the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 17, 2026
@vjeux
vjeux marked this pull request as ready for review November 17, 2026 09:14
github-actions Bot added a commit that referenced this pull request Nov 17, 2026
@cixzhang
cixzhang merged commit 13b8981 into meta:main Nov 17, 2026
153 checks passed
@cixzhang cixzhang removed the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 17, 2026
@vjeux
vjeux deleted the selector-overlay-clamp-translate branch November 17, 2026 10:32

This branch was successfully deployed

1 active deployment
Preview — 83c44150 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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.

2 participants