Skip to content

fix(core): keep disabled selectors closed on default open - #11488

Merged
cixzhang merged 3 commits into
meta:mainfrom
korkt-kim:korkt-kim/ast011-disabled-default-open
Nov 13, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
korkt-kim:korkt-kim/ast011-disabled-default-open

Conversation

@korkt-kim

Copy link
Copy Markdown
Contributor

User impact

A disabled Selector or MultiSelector can open its selection surface as soon as it mounts with isDefaultOpen. This also occurs when isReadOnly is set or disablement comes from an InputGroup. The field appears unavailable but exposes choices and reports itself expanded without the person activating it.

Problem and solution fit

The mount-only Effect checks !isEffectivelyReadOnly, but that state is isReadOnly && !isDisabled. Disabled controls therefore pass the initial-opening check, including when both availability props are true.

Both Effects now check resolved isDisabled before opening. This includes InputGroup disablement and rejects the opening before surface callbacks or native presentation. The Effects remain mount-only: enabling a previously blocked field does not invent a later default opening. Enabled default-open and ordinary selection retain their existing paths.

Expected behavior and authority

Current AST-085 FR2 and FR7 prohibit a disabled control from opening a surface or invoking a callback, including group-disabled members. AST-011 FR2 and FR5 exclude default opening while read-only and give disabled behavior precedence when both states are set. The fix applies the existing disabled availability rule to the initial-opening path.

Smallest restoration

  • One availability guard in each existing mount-only Effect.
  • Three named unit cases per component: enabled opening, disabled/read-only blocking, and group-disabled initialization without retry after enabling. No added it.each or combination matrix.
  • Two native opening/focus cases in the existing Chromium spec, retaining its original listbox-name regression and routing for both components.
  • One core patch Changeset.

No public prop, presentation default, styling, consumer documentation, specification, or shipped story is changed. Recording fixtures and media remain outside the implementation branch.

Evidence

  • Reproduction before the change: mounting either component disabled, read-only, and default-open exposes its popover and sets aria-expanded="true" without activating the field.
  • Result after the change: the same mount stays collapsed and exposes no selection surface. The native-browser cases also retain the disabled trigger's Tab stop and detect any transient native opening.
  • Representative unchanged paths: an enabled default-open field still opens; selecting Apple updates the controlled value and calls onChange once. A blocked InputGroup field remains closed when enabled later.
  • Regression proof: loading the base guards makes the four disabled/group unit cases observe expanded state while the two enabled controls retain their opening. All six cases pass with the fix.

Both recordings use the same real components, neutral light theme, data, 1100 × 800 viewport, and Chromium 149. The disabled step mounts the field through a recording-only control; it does not click or activate the field. Readouts come from the trigger's actual ARIA state and real onChange callbacks. AS-IS loads the base modules from 4d1cb828f6; TO-BE loads the exact source tree committed as b09c13fa07. The videos show the popover presentation; the browser regressions additionally cover blocked native sheet opening.

AS-IS

default-open-as-is.mp4

TO-BE

default-open-to-be.mp4

Scope

Components: Selector, MultiSelector

General open-surface lifecycle, custom-trigger read-only semantics, and unrelated disabled handlers are outside this change.

  • 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

  • pnpm exec vitest run --project ui --maxWorkers=2 packages/core/src/Selector packages/core/src/MultiSelector — 621 tests passed across 20 files.
  • pnpm exec playwright test packages/core/src/Selector/__tests__/Selector.a11y.chromium.spec.ts --config=playwright.config.ts --project=chromium — 3 tests passed, including the existing naming regression.
  • Strict ESLint on the five changed TypeScript files, Prettier, active LSP for the browser spec, and targeted TypeScript checking of the changed tests and dependencies passed.
  • Normal pre-commit hooks, including pnpm check:repo, passed.
  • pnpm lint:strict — repository checks passed; 0 errors and 237 warnings.

@vercel

vercel Bot commented Nov 13, 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 13, 2026 7:17pm UTC

Request Review

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

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 13, 2026, 7:36 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 742b429

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Selector 109.8 kB (+1 B) · 18.4 kB CSS (0) — ✗ · ✓ · ✓
SelectorOption 21.6 kB (0) · 6.4 kB CSS (0) — ✗ · ✓ · ✓
PowerSearch 306.1 kB (+6 B) · 25.3 kB CSS (0) — — · — · —
3 more components
Component Size LoC Visual · A11y · RTL
Pagination 120.9 kB (+2 B) · 18.8 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 298.3 kB (+2 B) · 454 B CSS (0) — — · — · —
MultiSelector · Storybook 101.2 kB (0) · 17.7 kB CSS (0) 2,718 (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) before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Wide Start (neutral, light) before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Narrow End RTL (neutral, dark) before frame after frame diff frame
Selector · Indicator Space Bottom Sheet Narrow End RTL (neutral, light) before frame after frame diff frame

Package size: @astryxdesign/core 7.52 MB packed (+14 B); no new dependencies.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@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. A maintainer adds the ci:run label so CI runs.

The fix keeps a disabled Selector or MultiSelector closed when it mounts with isDefaultOpen, including when it is also read-only or disabled by an InputGroup, which matches the rule that a disabled control never opens a surface or fires a callback. The new unit and Chromium cases fail without the guard and pass with it, so nothing else is needed from you.

Claims and files checked
  • Changeset: both components stay closed when mounted disabled with isDefaultOpen, read-only and group-disabled included. Verified: the unit and Chromium cases fail on the base and pass on this head.
  • Before the fix, a disabled default-open field opens and reports itself expanded. Verified: aria-expanded="true" on the base.
  • The old guard only excluded effective read-only, which is false whenever the field is disabled. Verified in both components.
  • Both mount Effects now check the resolved disabled state, group included, before opening or calling onOpenChange. Verified.
  • The Effects stay mount-only, so enabling a blocked field later does not open it. Verified by the no-retry cases.
  • Enabled default-open and ordinary selection are unchanged. Verified by the enabled cases and the full Selector and MultiSelector suites (621 tests).
  • The cited disabled-control and read-only records say what the description quotes. Verified.
  • Scope: one guard per component, three unit cases each, two Chromium cases, one patch changeset, and no API, docs, record or story change. Verified; the public API surface is unchanged.
  • The Chromium cases keep the disabled trigger's Tab stop and catch any native popover or dialog opening. Verified: 3 passed on this head, and both new cases fail on the base.
  • Lint, formatting and type checks pass on the changed files. Verified.
  • The recordings' selection and onChange readouts were not judged; the existing selection tests pass.
  • Files: .changeset/quiet-selectors-default-open.md, Selector.tsx, MultiSelector.tsx, Selector.test.tsx, MultiSelector.test.tsx and Selector.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b09c13f

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec c7ba07e

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 13, 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. A maintainer adds the ci:run label so CI runs.

The guard keeps a disabled Selector or MultiSelector closed when it mounts with isDefaultOpen, including when it is also read-only or disabled by an InputGroup, as the rule that a disabled control never opens a surface or fires a callback requires. The new unit and Chromium cases fail without the guard and pass with it, so nothing else is needed from you.

Claims and files checked
  • Changeset: both components keep their surfaces closed when mounted disabled with isDefaultOpen, read-only and group-disabled included. Verified: the unit and Chromium cases and browser probes fail on the base and pass on this head, and plain isDisabled behaves the same.
  • Before the fix, a disabled default-open field opens and reports itself expanded. Verified on the base: aria-expanded="true" with an open list or modal sheet.
  • The old guard only excluded effective read-only, which is false whenever the field is disabled. Verified in both components.
  • Both mount Effects now check the resolved disabled state, group included, before any surface callback or native opening. Verified: onOpenChange is not called and no showPopover or showModal call is recorded.
  • The Effects stay mount-only, so enabling a blocked field later does not open it. Verified by the no-retry cases.
  • Enabled default-open and ordinary selection are unchanged. Verified by the enabled cases, an identical enabled frame, and the full Selector and MultiSelector suites (621 tests).
  • The cited disabled-control and read-only rules say what the description states. Verified.
  • Scope: one guard per component, three unit cases each, two Chromium cases in the existing spec routed for both components, one patch changeset, and no API, style, docs, spec or story change. Verified; the public API surface is unchanged.
  • The Chromium cases keep the disabled trigger's Tab stop and catch any native opening. Verified: 3 passed on this head, and both new cases fail on the base.
  • Regression proof: with the base guard the four disabled and group cases fail while the two enabled cases pass. Verified.
  • The recordings' setup is stated in text and was not judged from the clips; what they show, a disabled mount staying closed and a pick calling onChange once, is covered by the new cases and the existing selection tests.
  • Lint, formatting and type checks pass. Verified for the changed files; the repository-wide runs are left to CI.
  • Files: .changeset/quiet-selectors-default-open.md, Selector.tsx, MultiSelector.tsx, Selector.test.tsx, MultiSelector.test.tsx and Selector.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 13, 2026 16:55
@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 16:55
github-actions Bot added a commit that referenced this pull request Nov 13, 2026
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 742b429

@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: the required checks are still finishing on this head.

The guard keeps a disabled Selector or MultiSelector closed when it mounts with isDefaultOpen, including when it is also read-only or disabled by an InputGroup, as the rule that a disabled control never opens a surface or fires a callback requires. The new unit and Chromium cases fail without the guard and pass with it, so nothing else is needed from you.

Claims and files checked
  • Changeset: both components keep their surfaces closed when mounted disabled with isDefaultOpen, read-only and group-disabled included. Verified: the unit cases, the Chromium cases and browser probes fail on the base and pass on this head, and plain isDisabled behaves the same.
  • Before the fix, a disabled default-open field opens and reports itself expanded. Verified on the base: aria-expanded="true" with an open list or modal sheet, and MultiSelector reports an open through onOpenChange.
  • The old guard only excluded effective read-only, which is false whenever the field is disabled. Verified in both components.
  • Both mount Effects now check the resolved disabled state, group included, before any surface callback or native opening. Verified: onOpenChange is not called and no showPopover or showModal call happens.
  • The Effects stay mount-only, so enabling a blocked field later does not open it. Verified by the no-retry cases.
  • Enabled default-open and ordinary selection are unchanged. Verified by the enabled cases, an identical enabled frame, and the full Selector and MultiSelector suites (623 tests at this head, after the base merges).
  • The cited disabled-control and read-only rules say what the description states. Verified.
  • Scope: one guard per component, three unit cases each, two Chromium cases in the existing spec routed for both components, one patch changeset, and no API, style, docs, spec or story change. Verified; the public API surface is unchanged.
  • The Chromium cases keep the disabled trigger's Tab stop and catch any native opening. Verified: 3 passed on this head.
  • Regression proof: with the base guard the four disabled and group cases fail while the two enabled cases pass. Verified.
  • The recordings' setup is stated in text and was not judged from the clips; what they show is covered by the new cases and the existing selection tests.
  • Lint, formatting and type checks pass. Verified by CI's lint and typecheck on this head.
  • Files: .changeset/quiet-selectors-default-open.md, Selector.tsx, MultiSelector.tsx, Selector.test.tsx, MultiSelector.test.tsx and Selector.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 13, 2026 19:36
@cixzhang
cixzhang merged commit 76642a0 into meta:main Nov 13, 2026
149 checks passed
@github-actions
github-actions Bot deleted the korkt-kim/ast011-disabled-default-open branch November 14, 2026 12:35

This branch was successfully deployed

1 active deployment
Preview — 742b429e Deployed Nov 13, 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. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants