Skip to content

feat(ComplexSelector): add disabledMessage - #5984

Merged
cixzhang merged 13 commits into
meta:mainfrom
AKnassa:ak-5941-complexselector-disabled-message
Nov 11, 2026
Merged

cixzhang merged 13 commits into
meta:mainfrom
AKnassa:ak-5941-complexselector-disabled-message

Conversation

@AKnassa

@AKnassa AKnassa commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What this does

ComplexSelector can now say why it is disabled. Pass disabledMessage together with isDisabled and the trigger stays reachable by keyboard, shows the reason on hover and focus, and still refuses to open.

Why

The input-field family contract (FR4) says a field that can be disabled should be able to explain why, the way Selector, MultiSelector and TextInput already do. ComplexSelector was the one selector without it, and #5941 lists that as a gap to close. Without a reason, a disabled control is a dead end for keyboard and screen-reader users.

What changed

  • A new optional disabledMessage prop on ComplexSelector, using the same recipe Selector and MultiSelector use.
  • With a reason, the reason shows as a tooltip on hover, keyboard focus and touch, and the tooltip is linked through aria-describedby after the description and the status message.
  • Without a reason, nothing changes: as on main, the disabled trigger keeps its tab stop with aria-disabled.
  • Opening stays blocked on every path while focusable-disabled (click, Enter, Space, ArrowDown, and the imperative handle), and onOpenChange stays silent.
  • Docs: the prop entry, a "Disabled with message" Storybook story, and a patch changeset.
  • With renderTrigger, the reason works on the caller's control too: the tooltip anchors to it through the handed ref, and the reason joins the handed aria-describedby. The caller drops its control's own tooltip while the selector is disabled (for example tooltip={isDisabled ? undefined : 'Filter'}), so the control shows only the reason. No development warning.

Authority

  • family:input-fields FR4 (current) owns the disabled-reason semantics: when a member exposes disabledMessage, the field stays focusable enough to expose the reason while activation stays blocked. This PR implements exactly that, with the same recipe Selector and MultiSelector use.
  • The ComplexSelector record (current) gains FR13 for disabledMessage, a variation row and a verification entry. family:input-fields FR4 owns the shared behavior, but a member is not required to adopt the prop, so adding it is a public-API decision for the project owner.
  • The family's "Current shipped facts" adoption row describes main in the present tense, so it changes in a records update after this ships, not before.

How to see it

Storybook → ComplexSelector → "Disabled with message". Hover the trigger, or Tab to it. Screenshots of the hover and focus states follow in a comment.

Evidence

The ComplexSelector disabledMessage suite has 20 tests (file total 41). The first 8 were red before the change and are green after it. The 12 edge-case tests pass on the change as written, so each was kept only after a one-line mutation of the production code made it fail: flipping the reason check to accept an empty string, moving the reason id first in aria-describedby, dropping the disabled guard from toggle(), dropping the tooltip ref from the composed container ref, clobbering the anchor name instead of composing it, and hiding the Spinner while disabled all turn one specific test red.

Covered: the full {isDisabled, disabledMessage} matrix including an empty string; aria-describedby order with every id resolving; Escape hides only the tooltip and keeps focus; focus leaving hides it; re-enabling at runtime removes aria-disabled, the tooltip and its id without moving focus, and re-disabling restores them; busy and disabled-reason states stay independent; the open tooltip stays anchored to the control box across a rerender; a touch tap reveals the reason without opening; a consumer onClick does not run from a disabled trigger, with or without a reason; and the ghost toolbar variant keeps aria-disabled and the reason.

Local checks, all on top of the current upstream main: ComplexSelector, Selector and MultiSelector suites (383 tests), core typecheck and docs typecheck, eslint with zero warnings, prettier, and the knowledge, changeset and SYNC checks.

Pre-existing gaps seen along the way, not changed here

  • statusVariant="tooltip" leaves a status id in aria-describedby that resolves to nothing. ComplexSelector never renders a status tooltip, and this happens without disabledMessage too.
  • Popup content can still commit a value if the field becomes disabled while the popup is open. commitValue is unguarded on main, with or without a reason.
  • If the reason tooltip is open when the field is re-enabled and then disabled again, it re-shows unprompted. Reproduced on Selector, so it belongs to the shared tooltip hook, in a separate PR.

Rubric

Triage: new API surface · non-breaking · low blast radius → deep path (the API shape is the maintainers' call; this is the shape #5941 and family FR4 ask for) · checks: §1 A1–A7/A11–A12, §3 P1–P7/P15–P18, §7 C1–C8/C11, §8 X5/X9–X12, §9 I1–I5, §3 P11–P12 · X20 changeset, §5b screenshots

Part of #5941 (ComplexSelector disabledMessage checkbox).

Rebase onto main (maintainer update)

Rebased onto current main, which changed ComplexSelector since this was opened: data-testid and other base props now reach the trigger button, a press anywhere in the control box routes through the trigger, and renderTrigger adds anchored mode. The disabled-reason tooltip still anchors on the control box; the tests that hovered the old test-id root now hover the control box. (The renderTrigger warning this note mentioned was later replaced by the wiring below.)

Maintainer follow-up

(Posted by Cindy's agent on her behalf.) Carried on this branch with the author's commits kept. Exact head: 736c569.

  • Merged main. Since this was opened, main makes every disabled trigger keep its tab stop with aria-disabled and run no handler on a disabled press (spec:AST-085). It also mounts the popup only when it opens and makes the busy Spinner decorative. So disabledMessage now adds only the reason tooltip and its description. The trigger, the onClick docs and the tests follow main: no native disabled, no caller onClick while disabled, no popup to read before it opens, and aria-busy instead of a status region.
  • A caller's own aria-disabled reaches an enabled trigger, per the last review. New test: "keeps a caller's aria-disabled on an enabled trigger". It fails with the trigger overriding aria-disabled.
  • The Changeset and docs say what the prop adds on top of main. The record's Compatibility line and the Changeset also name the one change for callers without the prop: a caller's own aria-disabled reaches an enabled trigger.
  • The reason tooltip anchors to the control box but listens on the trigger button, per the latest review, so the status info-tip (statusVariant="tooltip") opens only its own message. New test: "opens only the status message from the info-tip, not the disabled reason". It fails with the listeners on the control box. FR13 says so.
  • The record carries FR13, its variation row and its verification entry, so the owner reviews the prop and its contract together.
  • vitest run packages/core/src/ComplexSelector: 92 passed. Core tsc, eslint, check:knowledge, check:changesets and the comment-provenance baseline pass.

Render trigger (owner decision)

The owner chose "Wire it for render trigger", recorded as DEC-2 in the ComplexSelector record.

  • The disabled-reason tooltip's ref is merged into the ref handed to the caller's control, its description joins the handed aria-describedby after the caller's own, and the tooltip renders beside the popup.
  • No new API, public or internal: the caller drops its control's own tooltip while the selector is disabled, for example tooltip={isDisabled ? undefined : 'Filter'}. The JSDoc, the component doc and the changeset say so. Button is unchanged.
  • The owner directed that the "a control never shows two tooltips" guardrail belongs in the Tooltip system itself, not in each caller (DEC-2). Until Tooltip provides it, a caller-rendered trigger drops its own tooltip while disabled.
  • The development warning for this case is gone; the styling-props warning stays.
  • Tests: hover, keyboard focus and tap reveal on a caller's control, and the reason joining the caller's aria-describedby after its own description. All four fail on the head before the wiring. ComplexSelector and Button suites pass (185 with the shared-context suite); core tsc, ESLint, check:knowledge, check-use-client and the component import-boundary check pass.

Writing rubric results

Run over the ComplexSelector.spec.md edits (FR13, the disabled reason variation row, the FR13 verification row, and the Compatibility line).

  • R1 narration: none. The added text is present tense; a scan for proposes, we decided, previously, a port of, now, used to and before finds nothing.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. The verification row names a test suite, not a pull request, issue or commit.
  • R4 rejected alternatives over one line or outside a decision: none.
  • R5 pull request or issue references remaining: none. A search of the added lines for # followed by digits, /pull/ and /issues/ finds no matches.
  • R6 ruled open questions still listing options: none.

@vercel

vercel Bot commented Sep 3, 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 11, 2026 9:38am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 3, 2026
@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 needs:spec-owner-review Current knowledge records await owner approval labels Sep 3, 2026
github-actions Bot added a commit that referenced this pull request Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 736c569

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/TransferListSelector 114.1 kB (+112 B) · 1.4 kB CSS (0) — — · — · —
ComplexSelector · Storybook 75.5 kB (+78 B) · 11.9 kB CSS (0) 732 (+30) ✓ · ✓ · ✓

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

API changes: core +1 · ~0 · −0

1 API change (advisory)
Package Where Signature Usage
+ core . · Components · component ComplexSelector prop disabledMessage?: string <ComplexSelector disabledMessage={…} />

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


Generated by PR Enrichment workflow | View full report

Adopt the input-field family's disabled-reason contract (FR4): with
isDisabled, the trigger stays focusable via aria-disabled, shows the
reason as a tooltip on hover, keyboard focus, and touch, linked through
aria-describedby, and opening stays blocked by pointer, keyboard, and
the imperative handle. Without a reason the trigger is natively
disabled exactly as before. Same recipe as Selector and MultiSelector.

The component spec records the API delta (before -> after and a
verification row) per AST-002 FR12/FR13. Twenty tests pin the
{isDisabled, disabledMessage} matrix, aria-describedby order, Escape
and focus-out dismissal, runtime re-enable, busy plus reason, composed
anchors across rerenders, touch, the ghost variant, and Selector parity
for a consumer onClick.

Part of meta#5941 (ComplexSelector checkbox).

Claude-Session: https://claude.ai/code/session_01N5RkmXVgx725F6rqZTGecR
@cixzhang
cixzhang force-pushed the ak-5941-complexselector-disabled-message branch from 0c0b1c8 to d7ea3b1 Compare October 16, 2026 23:03
@cixzhang
cixzhang marked this pull request as ready for review October 16, 2026 23:04
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 16, 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.

The disabledMessage behavior follows the input-field family's disabled-reason rule and is well covered by tests, but approval waits on a maintainer decision about the new requirements this PR writes into the draft ComplexSelector spec. A maintainer needs to approve or revise three draft statements: the aria-disabled/aria-describedby accessibility contract (including the description order), the new "Disabled reason" verification row, and the rule that disabledMessage has no effect with renderTrigger. The family adoption row that still lists ComplexSelector without a disabled-reason API also needs a maintainer update. Two optional improvements in the meantime: add the ## Writing rubric results section the contributing guide asks for when a PR touches a spec record, and say in the onClick or disabledMessage docs that a consumer click handler still runs while the selector is disabled with a reason.

[Automated review]

…keep family semantics in the family record

- AST-002 FR15: renderTrigger plus disabledMessage was a silent no-op; it now
  warns in development, like the container*/control* props already do.
- Document that a caller onClick still runs while disabled with a reason.
- AST-002 FR12: disabledMessage semantics are family-owned (family:input-fields
  FR4), so the draft component spec no longer restates them.

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

This adds disabledMessage to ComplexSelector in line with the input-field family's disabled-reason rule, and nothing blocking was found. With a reason, the trigger stays reachable by keyboard and carries the reason in its accessible description. Every way of opening the popup stays blocked, and renderTrigger callers get a development warning instead of a silent no-op. No changes are needed from you.

[Automated review]

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

disabledMessage follows the input-field family's disabled-reason rule: with a reason, the disabled trigger is reachable by keyboard, exposes the reason as its accessible description, and never opens the popup. One change is needed before approval: the new aria-disabled={showsDisabledMessage ? 'true' : undefined} on the trigger comes after the base-prop spread, so an aria-disabled a caller passes no longer reaches the button in any state without a reason, although base props are documented to reach the trigger. Please keep the caller's value in that case (for example, destructure 'aria-disabled' the way aria-describedby is and render aria-disabled={showsDisabledMessage ? 'true' : ariaDisabledProp}), and add a test that a caller aria-disabled reaches the trigger when no reason is shown.

[Automated review]

…or-disabled-message

# Conflicts:
#	apps/storybook/stories/ComplexSelector.stories.tsx
#	packages/core/src/ComplexSelector/ComplexSelector.tsx
…d trigger, and keep a caller's aria-disabled

main now keeps every disabled trigger's tab stop with aria-disabled and
runs no handler on a disabled press. disabledMessage adds only the reason
tooltip and its description. A caller's own aria-disabled reaches an
enabled trigger. The tests, docs and Changeset follow.

Co-authored-by: Cindy Zhang <[email protected]>
@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

Deployment failed for project astryx with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

@cixzhang cixzhang added 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) labels Nov 9, 2026
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 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.

disabledMessage gives a disabled ComplexSelector a reason people can reach on both the built-in trigger and a renderTrigger control, and the FR13 and DEC-2 record changes have an engineering owner's approval at this head; four fixes remain before approval.

Blocking

  • Tooltip/labelTooltipSuppression.ts:18 creates its context with createContext, so the repository's "no module creates a context of its own" test (sharedContexts.test.tsx) fails in CI and a swizzled ComplexSelector or Button no longer reaches the package's copy; create it with createSharedContext('LabelTooltipSuppressionContext', 1, false) as every other Core context does.
  • The same file has no 'use client' directive, so the lint job fails in check:use-client; add it as the first statement after the copyright line.
  • FR13, DEC-2, the prop's JSDoc, the doc entry and the changeset say the reason replaces any label tooltip the caller's control has, but only Button reads the new context, so an interactive Avatar (or a control wrapped in Tooltip) used as the trigger shows its own tooltip on top of the reason; read the context in useTooltip and test a non-Button control, or narrow those texts to Button-based controls.
  • The changeset (line 5) and the record's Compatibility line (ComplexSelector.spec.md:46) still say a caller's own aria-disabled reaches an enabled trigger, but the renderTrigger path still replaces it (ComplexSelector.tsx:903); write "an enabled built-in trigger" or pass the value through on that path with a test.

If a fix changes the record's text, it needs a fresh /approve-spec at the new head.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 176db21

@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: disabledMessage works on the built-in trigger and on an IconButton renderTrigger, and the record changes are approved at this head, but four things need fixing first.

  • packages/core/src/Tooltip/labelTooltipSuppression.ts:20 creates its context with createContext, so sharedContexts.test.tsx ("no module creates a context of its own") fails in CI and a swizzled ComplexSelector or Button no longer reaches the other; use createSharedContext('LabelTooltipSuppressionContext', 1, false).
  • Found by CI: Button.tsx:34 imports the context from the Tooltip/ surface folder, which check:component-import-boundaries rejects as an unlisted Button/Button → Tooltip/labelTooltipSuppression crossing (component-import-boundaries INV1), so lint fails; move the context out of Tooltip/ or read it inside useTooltip so Button imports nothing new.
  • Only Button reads the suppression context, so an interactive Avatar, a Link with tooltip or a Tooltip-wrapped renderTrigger control still shows its own tooltip over the reason, against what FR13, DEC-2, the JSDoc, the doc entry and the changeset say; read the context in useTooltip and test a control that is not a Button, or narrow those texts (a record edit needs a fresh /approve-spec).
  • The changeset and the record's Compatibility line say a caller's aria-disabled now reaches "an enabled trigger", but the renderTrigger path still sets it from isDisabled alone (ComplexSelector.tsx:903); write "an enabled built-in trigger", or pass the caller's value through on that path with a test.

The smaller notes (two comments that restate the code, a stale story comment and a test assertion that cannot fail) are in the open inline threads.

Automated review (maintainer link)

Comment thread packages/core/src/Button/Button.tsx Resolved
…oss copies; aria-disabled wording names the built-in trigger
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
…ile disabled

The owner chose to keep the "never two tooltips" guardrail for the Tooltip
system itself, so the internal suppression context and Button's read of it
go. With renderTrigger, the disabled reason still reveals on the caller's
control and joins its aria-describedby; the docs, the changeset and the
ComplexSelector record tell callers to drop that control's own tooltip while
the selector is disabled. DEC-2 records the owner direction.

@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 spec decision, and one fix is needed. The reason now works on the built-in trigger (Tab, hover and a tap show it, it becomes the trigger's description, and the popup stays closed), and the shared-context, import-boundary and aria-disabled wording issues from the last review are fixed. FR13, DEC-2 and their rows in the ComplexSelector record were approved at an earlier commit, and this commit edits the record again, so approval needs an engineering owner to comment /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner), deciding whether the reason replaces every control's label tooltip or only a Button-based control's.

Required fix:

  • Only Button reads the suppression context (Button.tsx:794), so an interactive Avatar or a Link with tooltip used as renderTrigger still opens its own tooltip over the reason, although FR13, DEC-2, the prop docs, the JSDoc and the changeset say the reason replaces any control's label tooltip: read the context in the shared useTooltip and add a test with a control that is not a Button, or narrow those texts to Button-based controls.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 2c8d4c6

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

disabledMessage works on the built-in trigger and on a renderTrigger control, and the record changes are approved at this head; one fix to the pull request description is needed.

  • The description's "What changed" and "Render trigger" sections say the reason replaces a renderTrigger control's own tooltip through an internal context that Button reads, with IconButton tests, but this head removed that context and those tests, so an IconButton that keeps tooltip="Filter" opens both bubbles; update both sections to say the caller drops its control's own tooltip while the selector is disabled.

Non-blocking: DEC-2's first paragraph still describes the replacement as the component's own, unlike FR13, and FR13 and DEC-2 phrase the interim rule as "until Tooltip ..."; the inline notes cover these and a few comments that describe earlier wiring.

Automated review (maintainer link)


With `renderTrigger`, `disabledMessage` reveals and describes on the caller's control through the props and ref the component hands it (`spec:AST-055`); while the reason shows, it replaces the control's own label tooltip, so a control never shows two tooltips. The owner chose "Wire it for render trigger". Rejected: the prop having no effect with `renderTrigger`, and a development warning for that case.

Owner direction 2026-11-10: the guardrail that a control never shows two tooltips belongs in the Tooltip system itself, not in each caller; until Tooltip provides it, a caller-rendered trigger drops its own tooltip while disabled.

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: "until Tooltip provides it" (and FR13's "until Tooltip itself keeps a control from showing two tooltips", line 126) states temporary project status. The record can state the present rule alone, for example "A caller-rendered trigger drops its own tooltip while disabled.", and the Tooltip guard can get its own record when it exists.

Source and test comments no longer describe the earlier tooltip wiring, and
DEC-2's first paragraph states the decision as it stands under the owner's
direction.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 736c569

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

disabledMessage gives a disabled ComplexSelector a reason people can reach: hover, Tab or a tap on the trigger shows it, it becomes the trigger's accessible description, and the popup still cannot open. This works on the built-in trigger and on a renderTrigger control. The FR13 and DEC-2 record changes have an engineering owner's approval for this head, and the description now matches the wiring.

Optional cleanups, not blocking:

  • FR13 and DEC-2 could state the present rule alone ("A caller-rendered trigger drops its own tooltip while disabled.") instead of "until Tooltip provides it".
  • The "Disabled with message" story comment could drop "disabled controls swallow the pointer events a Tooltip wrapper needs": the trigger is never natively disabled now, and a wrapping Tooltip describes the Field root, not the trigger.

Automated review (maintainer link)

@cixzhang cixzhang 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 by Cindy's agent, per her decisions on this PR.) Reviewed at 736c569: disabledMessage shows its reason on the built-in trigger and, with renderTrigger, on the caller's control through the handed ref and aria-describedby; a caller drops its own tooltip while disabled. Thank you, @AKnassa!

@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 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

Decision: D-20261111-254

@cixzhang
cixzhang merged commit fa9e7f0 into meta:main Nov 11, 2026
81 checks passed
@github-actions
github-actions Bot deleted the ak-5941-complexselector-disabled-message branch November 11, 2026 13:33

This branch was successfully deployed

1 active deployment
Preview — 736c569a Deployed Nov 11, 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