Skip to content

spec(Selector): a closed Selector holds no option list - #9586

Draft
cixzhang wants to merge 7 commits into
mainfrom
spec/selector-mount-on-open
Draft

cixzhang wants to merge 7 commits into
mainfrom
spec/selector-mount-on-open

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

A page with many Selectors becomes usable sooner and holds far less. Today every closed Selector keeps its whole option list mounted. Measured on a page with 20 Selectors of 249 options each (production build, popover presentation, 4× CPU slowdown, median of 7 loads), building the list on every open and removing it on close gives:

What a person waits for Today This record
Page load to first paint 1,964 ms 321 ms
Main thread blocked during load 1,975 ms 334 ms
Elements after load 30,203 202
JavaScript memory after load 52.0 MB 7.8 MB
First open, first Selector used 286 ms 397 ms
Reopen the same Selector 197 ms 250 ms
Elements after opening and closing two Selectors 30,218 218
Memory after opening two Selectors 52.3 MB 9.0 MB

Each open costs a little more (about 50 ms on a 249-option reopen in this setup). The roughly 200 ms that every open of a long list costs is separate work; this record sets no rule for it and notes it under Current-state impact.

Exact decision needed

None open. The owner decided when a Selector builds its option list.

Existing authority searched

Decision

The owner, on 2026-11-02: "I think best is we do B and we improve open time for large selector options".

Recorded as component:Selector PR3 and DEC-2:

  • While closed, a Selector renders no list content on either surface: a surface may keep an empty, inert anchor marker, but no listbox, option, search row, or other list content exists. The trigger, its Field label and status, the clear button, the busy spinner and the form value (FR6) render as before.
  • Every open, popover and bottom sheet alike, mounts the list; every close removes it once the close settles, and the exit still shows the list (spec:AST-090 FR11, DEC-4).
  • The first open starts its highlight where a later open by the same path starts it, which is FR8's start: "Opening the closed list highlights the selected option when it is enabled. Otherwise ArrowUp highlights the last enabled option, and every other way of opening (ArrowDown, a press, Enter, Space) the first enabled option; with no enabled option nothing is highlighted. A disabled option is never highlighted on opening. A search list opened by a press, Enter or typing highlights nothing." The element AR2 gives the combobox relationship (the trigger, or the search input when search is on) names it in aria-activedescendant, and FR2 alignment holds.
  • Closed-trigger typeahead (FR7) and the form value (FR6) read option data, never the list.
  • aria-controls names the list only while it exists.
  • Its Current-state impact opens with "PR3 gap: a closed Selector keeps its whole option list mounted".

Release class: patch [fix]. Undocumented markup is not a released contract (spec:AST-017 FR3); documented selection, keyboard, accessibility, and form behavior stays the same, so no caller must change source (FR1); a victim-free correction is [fix] with a patch bump (FR5, FR7).

Rejected alternatives

  • Build the list on the first open and keep it (A): faster reopens, but every opened Selector keeps its list in memory for the life of the page.
  • Keep today's behavior (C): every closed Selector keeps its list and the page pays for all of them at load.

Claim scope and non-goals

  • Governs only when the option list exists. Open time for long lists, MultiSelector, and the Popover default are out of scope.

Evidence and implementation relationship

  • Measurements above come from a prototype that turns on the Layer's existing lazy-mount option for the Selector popover. No implementation pull request yet.

Changed records

  • component:Selector: new PR3, DEC-2, a Current-state impact section (PR3 gap, open time for long lists), a compatibility line with the release class, and six verification rows (closed element count; first and later opens' active option and alignment; typeahead while closed; form submission; exit animation; aria-controls presence).

Writing rubric results

  • R1 narration: one sentence opened "PR3 removes"; rewritten as "A closed Selector renders no option list (PR3)".
  • R2 research in the record: none; the measurements live in this description only, and DEC-2 keeps a one-sentence conclusion.
  • R3 evidence naming a change: none; verification cells name tests and stories.
  • R4 rejected alternatives over one line or outside a decision: one, inside DEC-2, one line.
  • R5 pull request or issue references remaining: none in the record.
  • R6 ruled open questions still listing options: none; Open questions stays "None".
  • R7 project status: "Implementation gap: not built" and two "separate work" phrases removed; the gap reads "PR3 gap: a closed Selector keeps its whole option list mounted".

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
  • Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
  • It records one intentional durable decision, not a rescue for a separable tagalong.
  • The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
  • Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
  • Public text and artifacts contain no internal Meta context.

Validation

  • pnpm install --frozen-lockfile: passed
  • pnpm check:knowledge: "Knowledge templates and records are aligned."
  • Prettier: clean
  • git diff --check: clean

@vercel

vercel Bot commented Nov 2, 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 19, 2026 12:15am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 27, 2026, 12:15 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 2, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 7da075c

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 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.

Requesting changes: the list-lifetime decision is owner-approved, but one sentence in PR3 needs fixing before this lands.

  • It says the trigger's aria-activedescendant names the active option on every open, but with search on, AR2 and spec:AST-058 FR6 put it on the search input, which holds focus.
  • Its start rule (selected, else first enabled) changes where ArrowDown, ArrowUp, searchable and disabled-first opens start today, while the compatibility line says documented keyboard behavior stays the same. Either say only that the first open starts like a later one, or record the change and reconcile it with #8868.

[Automated review]

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 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.

Approval waits on an engineering owner's decision on the Selector record changes. The /approve-spec on this pull request named the previous head, and the latest commit changed PR3, so PR3, DEC-2, the compatibility line, Current-state impact and the new verification rows need a fresh decision: an engineering owner records it by commenting /approve-spec <full head SHA> on the pull request, and the author may do so as an engineering owner.

  • Miss: the PR3, FR2 verification row (Selector.spec.md:396) still fails an implementation whose open does not start on the selected or first enabled option, while PR3 now keeps today's start (ArrowDown on the first option, ArrowUp on the last, no active option when a search list opens by a press or Enter), so reword the row to test that the first open starts where a later open by the same path starts it and that AR2's combobox element names it.

Fixing the row is a new commit, so approving the head that carries it avoids a second approval. The earlier aria-activedescendant and PR3 start-rule findings are fixed, though the description's Decision list still describes the old start rule.

[Automated review]

…t on every open

PR3 keeps today's start for each open path, so the row now checks that the first open starts its highlight where a later open by the same path does, that the combobox element names it, and that FR2 alignment holds, across press, Enter, ArrowDown and ArrowUp, with and without a value, search on and off.

@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.

Approval waits on an engineering owner's decision on the Selector record changes, and the branch needs main merged first.

  • The Verification map in Selector.spec.md (lines 383-401) conflicts with main, which added FR8, FR9, FR10 and a required-search AR1 row and re-padded the table, so merge main, keep those rows and add the six PR3 rows.

PR3, DEC-2, the compatibility line, Current-state impact and the six PR3 verification rows are new requirements and the only /approve-spec names the first commit, so an engineering owner records the decision by commenting /approve-spec <full head SHA> on the head that carries the merge (the author may do so as an engineering owner). While merging, three non-blocking wording fixes are worth making: PR3's "so the exit plays on the list" gives a reason the exit-motion spec's DEC-4 rules out for the popover, whose exit plays on the layer's exit copy; main's INV32 asks for a PR3 gap: … line in place of "Implementation gap: not built" and the two "separate work" phrases; and the description still describes the open start from before FR8 and lists the highlight pull requests as open.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: every closed Selector keeps its whole option list mounted today: verified, the popover renderer and the bottom sheet receive the panel while closed.
  • Claim: the change touches only undocumented markup, so no caller changes source and documented behavior stays the same: verified against FR8 and the documented aria-controls rule of the public combobox hook.
  • Claim: it ships as a patch [fix]: verified against the release spec's victim-free correction rule.
  • Claim: the first open keeps today's start, ArrowDown on the first option and ArrowUp on the last: false on main, where FR8 starts every path on the enabled selected option.
  • Claim: the open-highlight pull requests are still open and do not collide: stale, both landed as FR8 and FR9; no collision.
  • Claim: six new verification rows: verified.
  • Claim: load-time and memory measurements: not reproduced, they come from a prototype outside this pull request.
  • Claim: the knowledge check passed: not re-run.
  • File docs/specs/components/Selector/Selector.spec.md: the Verification map conflicts with main; the wording notes above.

Automated review (maintainer link)

Keeps main's FR8, FR9, FR10 and required-search AR1 verification rows and adds the six PR3 rows; the PR3 open-start row also cites FR8. PR3's exit wording follows AST-090 FR11 and DEC-4, and the gap wording follows knowledge-contracts INV32.

@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.

Approval waits on an engineering owner's decision on the component:Selector record changes, plus one fix to the pull request description.

PR3, DEC-2, the patch [fix] compatibility line, the Current-state impact section and the six PR3 verification rows are new record text, and no /approve-spec names this head. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.

Blocking:

  • The description's Decision list still says PR3 is marked "Implementation gap: not built" and removes the list "after the exit animation when one plays", while the record at this head has only the "PR3 gap" line in Current-state impact and says every close removes the list "once the close settles, and the exit still shows the list", so please update those two bullets and the R1 rubric line, whose "Every open starts the same way" is not in the record (a description edit adds no commit).

Non-blocking: the Behavioral and layout contract lead still says every requirement there is shipped, and PR3's first sentence lists fewer closed-state parts than a Selector renders (see the inline note).

Claims and files checked

Review mode: full; reason: spec-record

  • Load, element and memory measurements: unverified, they come from a prototype that is not in this pull request.
  • The owner decided when the list exists: verified, DEC-2 records that decider and date.
  • Popover keeps its closed host and lazy mounting is a Layer option: verified in the Popover record's side effects and lifetime.
  • ContextMenu keeps its surface after the first open: verified, its PR1.
  • The open-start, search-highlight and presentation-hold changes have landed: verified, all three are merged.
  • A closed Selector renders only its trigger and form value, with an inert marker allowed: verified, PR3.
  • Every open mounts the list and every close removes it after the exit animation: false, PR3 now says once the close settles while the exit still shows the list.
  • A first open starts its highlight as FR8 starts it, named by AR2's combobox element, with FR2 alignment: verified, PR3 and its FR2/FR8 row.
  • Closed typeahead and the form value read option data: verified, PR3 and current Selector code.
  • aria-controls names the list only while it exists: verified, PR3 and its AR1 row.
  • PR3 is marked "Implementation gap: not built": false, only the Current-state "PR3 gap" line remains.
  • Patch [fix] under the release record's FR1, FR3, FR5 and FR7: verified as the record states it.
  • Changed records (PR3, DEC-2, Current-state impact, compatibility line, six rows): verified.
  • Writing rubric R1: false, "Every open starts the same way" is not in the record; R2 to R6: verified.
  • Install, knowledge check, Prettier and whitespace check: verified, all pass at this head.
  • docs/specs/components/Selector/Selector.spec.md: one blocking description mismatch, two non-blocking wording notes; merges cleanly with main.

Automated review (maintainer link)

No verified source shows the owner deciding this decision yet. The decider is named, with its source, when the owner approves this specification.

@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.

Approval waits on an engineering owner's decision on the component:Selector record changes; nothing else blocks.

PR3, DEC-2, the patch [fix] compatibility line, the Current-state impact section and the six PR3 verification rows are new requirements with no /approve-spec for this head: an engineering owner records the decision by commenting /approve-spec <full head SHA> on the pull request, and the author may do so as an engineering owner. Either wording point below is a new commit, so take it before that approval if you take it at all.

Non-blocking:

  • The lead of the behavioral and layout contract (Selector.spec.md line 164) says every requirement under it ships, but PR3 is a named gap; adding "apart from the gaps Current-state impact names" keeps an implementer from reading PR3 as shipped.
  • PR3's first sentence (lines 221-222) says a closed Selector renders only its trigger and form value, which also rules out the label, status, spinner and clear button; saying it renders no list content matches the verification row.
Claims and files checked

Review mode: same-head; reason: none

  • Claim: every closed Selector keeps its whole option list mounted today. Verified: the panel goes to the popover or the bottom sheet while closed (Selector.tsx 2220-2246), the sheet keeps its children while closed, and the Popover default keeps its closed host.
  • Claim: the load, memory and open-time measurements, including about 50 ms more per reopen. Not reproducible here: they come from a prototype that is not in this pull request; the 50 ms matches the table's reopen row.
  • Claim: open time for long lists is not governed and is noted under Current-state impact. Verified (line 123).
  • Claim: no decision is open; the owner chose to build the list on every open. Consistent with the owner's approval of the first commit; the approval of this head is still outstanding.
  • Claim: no current Selector claim sets the list's lifetime. Verified.
  • Claim: the Popover default keeps its host mounted and lazy mounting is a Layer option. Verified (Popover record, side effects and lifetime).
  • Claim: the layer runtime owns the shared exit copy, and Selector is a layer surface whose exit a theme turns on. Verified.
  • Claim: ContextMenu keeps its surface after the first open, and this record differs on purpose. Verified (ContextMenu PR1; DEC-2).
  • Claim: the opening-highlight, query-clearing and presentation-hold work has landed, and PR3 keeps whatever start each open has. Verified on the base branch and at lines 225-226.
  • Claim: a closed Selector renders only its trigger and form value, with no list on either surface and an inert marker allowed. Verified as the record's wording (lines 221-224).
  • Claim: every open mounts the list and every close removes it once the close settles, with the exit still showing it. Verified (line 225).
  • Claim: the first open starts where a later open by the same path starts, which is the opening-highlight rule quoted in full, named by the combobox element with alignment kept. Verified: the quote matches the record word for word (lines 175 and 225-229).
  • Claim: typeahead and the form value read option data, and aria-controls names the list only while it exists. Verified (lines 230-232).
  • Claim: Current-state impact opens with the PR3 gap line. Verified (line 121).
  • Claim: the release class is a patch fix, with its compatibility reasoning. Verified as the record's line (lines 82-87); the class is part of the owner decision.
  • Claim: the rejected alternatives. Keeping each list after its first open is rejected in DEC-2 (lines 432-433); keeping today's behavior is described only in the pull request.
  • Claim: the record governs only when the list exists; open time, MultiSelector and the Popover default stay out of scope. Verified.
  • Claim: the changed-records list (PR3, DEC-2, Current-state impact, compatibility line, six rows). Verified.
  • Claim: rubric results R1 to R7. Verified: the R1 rewrite is at line 82, R2 to R6 hold, and the status phrases R7 names are gone, with the gap in requirement-gap form.
  • Claim: specification records only, with no internal context. Verified.
  • Claim: install, knowledge check, Prettier and whitespace check pass. Verified at this head.
  • File: docs/specs/components/Selector/Selector.spec.md. Non-blocking wording at lines 164 and 221-222; clear otherwise.

Automated review (maintainer link)

@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.

Approval waits on an engineering owner's decision on the component:Selector record changes; nothing else blocks.

PR3, DEC-2, the patch [fix] compatibility line, the Current-state impact section and the six PR3 verification rows are new requirements with no /approve-spec for this head: an engineering owner records the decision by commenting /approve-spec <full head SHA> on the pull request, and the author may do so as an engineering owner. The description now matches PR3.

Non-blocking:

  • The lead of the behavioral and layout contract (Selector.spec.md line 164) says every requirement under it ships, but PR3 is a named gap; adding "apart from the gaps Current-state impact names" keeps an implementer from reading PR3 as shipped, and since it is a new commit, take it before the approval if you take it at all.
Claims and files checked

Review mode: same-head; reason: none

  • Claim: every closed Selector keeps its whole option list mounted today. Verified: the panel goes to the popover or the bottom sheet while closed (Selector.tsx 2221-2246), the sheet keeps its children while closed, and the Popover default keeps its closed host.
  • Claim: the load, memory and open-time measurements, including about 50 ms more per reopen. Not reproducible here: they come from a prototype that is not in this pull request; the 50 ms matches the table's reopen row.
  • Claim: open time for long lists is not governed and is noted under Current-state impact. Verified (line 123).
  • Claim: no decision is open; the owner chose to build the list on every open. Consistent with the owner's approval of the first commit; approval of this head is still outstanding.
  • Claim: no current Selector claim sets the list's lifetime. Verified.
  • Claim: the Popover default keeps its host mounted and lazy mounting is a Layer option. Verified (Popover record, side effects and lifetime; the Layer's lazy-mount option).
  • Claim: the layer runtime owns the shared exit copy, and Selector is a layer surface whose exit a theme turns on. Verified.
  • Claim: ContextMenu keeps its surface after the first open, and this record differs on purpose. Verified (ContextMenu's resource rule; DEC-2).
  • Claim: the opening-highlight, query-clearing and presentation-hold work has landed, and PR3 keeps whatever start each open has. Verified: all three pull requests are merged, and PR3 keeps each path's start (lines 224-225).
  • Claim: a closed Selector renders no list content on either surface, an empty inert marker is allowed, and the trigger, label, status, clear button, spinner and form value render as before. Verified (lines 221-223; those parts render outside the list).
  • Claim: every open mounts the list and every close removes it once the close settles, with the exit still showing it. Verified (line 224).
  • Claim: the first open starts where a later open by the same path starts, quoting the opening-highlight rule in full, named by the combobox element with alignment kept. Verified: the quote matches the record word for word (lines 175 and 224-228).
  • Claim: typeahead and the form value read option data, and the list reference exists only while the list does. Verified (lines 229-231).
  • Claim: Current-state impact opens with the PR3 gap line. Verified (line 121).
  • Claim: the release class is a patch fix, with its compatibility reasoning. Verified as the record's line (lines 82-87); the class is part of the owner decision.
  • Claim: the rejected alternatives. Keeping each list after its first open is rejected in DEC-2 (lines 431-432); keeping today's behavior is described only in the pull request.
  • Claim: the record governs only when the list exists; open time, MultiSelector and the Popover default stay out of scope. Verified.
  • Claim: the changed-records list (PR3, DEC-2, Current-state impact, compatibility line, six rows). Verified.
  • Claim: rubric results R1 to R7. Verified: the R1 rewrite is at line 82, R2 to R6 hold, and the status phrases R7 names are gone, with the gap in requirement-gap form.
  • Claim: specification records only, with no internal context. Verified.
  • Claim: install, knowledge check, Prettier and whitespace check pass. Verified at this head.
  • File: docs/specs/components/Selector/Selector.spec.md. Non-blocking wording at line 164; clear otherwise.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — b80f0db3 Deployed Nov 19, 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. needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant