Repository navigation
feat(ComplexSelector): add disabledMessage - #5984
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
| 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
0c0b1c8 to
d7ea3b1
Compare
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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]>
|
Deployment failed for project astryx with the following error: |
There was a problem hiding this comment.
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:18creates its context withcreateContext, 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 withcreateSharedContext('LabelTooltipSuppressionContext', 1, false)as every other Core context does.- The same file has no
'use client'directive, so thelintjob fails incheck: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 inuseTooltipand 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 ownaria-disabledreaches an enabled trigger, but therenderTriggerpath 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.
|
/approve-spec 176db21 |
…so Button gains no new component import
There was a problem hiding this comment.
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:20creates its context withcreateContext, sosharedContexts.test.tsx("no module creates a context of its own") fails in CI and a swizzled ComplexSelector or Button no longer reaches the other; usecreateSharedContext('LabelTooltipSuppressionContext', 1, false).- Found by CI:
Button.tsx:34imports the context from theTooltip/surface folder, whichcheck:component-import-boundariesrejects as an unlistedButton/Button→Tooltip/labelTooltipSuppressioncrossing (component-import-boundaries INV1), solintfails; move the context out ofTooltip/or read it insideuseTooltipso Button imports nothing new. - Only Button reads the suppression context, so an interactive Avatar, a Link with
tooltipor aTooltip-wrappedrenderTriggercontrol 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 inuseTooltipand 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-disablednow reaches "an enabled trigger", but therenderTriggerpath still sets it fromisDisabledalone (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.
…oss copies; aria-disabled wording names the built-in trigger
…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.
There was a problem hiding this comment.
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 withtooltipused asrenderTriggerstill 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 shareduseTooltipand add a test with a control that is not a Button, or narrow those texts to Button-based controls.
|
/approve-spec 2c8d4c6 |
There was a problem hiding this comment.
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
renderTriggercontrol'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 keepstooltip="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.
|
|
||
| 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. |
There was a problem hiding this comment.
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.
|
/approve-spec 736c569 |
There was a problem hiding this comment.
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.
|
Decision: D-20261111-254 |
What this does
ComplexSelector can now say why it is disabled. Pass
disabledMessagetogether withisDisabledand 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
disabledMessageprop on ComplexSelector, using the same recipe Selector and MultiSelector use.aria-describedbyafter the description and the status message.main, the disabled trigger keeps its tab stop witharia-disabled.onOpenChangestays silent.renderTrigger, the reason works on the caller's control too: the tooltip anchors to it through the handed ref, and the reason joins the handedaria-describedby. The caller drops its control's own tooltip while the selector is disabled (for exampletooltip={isDisabled ? undefined : 'Filter'}), so the control shows only the reason. No development warning.Authority
family:input-fieldsFR4 (current) owns the disabled-reason semantics: when a member exposesdisabledMessage, 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.disabledMessage, a variation row and a verification entry.family:input-fieldsFR4 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.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 disabledMessagesuite 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 inaria-describedby, dropping the disabled guard fromtoggle(), 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-describedbyorder with every id resolving; Escape hides only the tooltip and keeps focus; focus leaving hides it; re-enabling at runtime removesaria-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 consumeronClickdoes not run from a disabled trigger, with or without a reason; and the ghost toolbar variant keepsaria-disabledand 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 inaria-describedbythat resolves to nothing. ComplexSelector never renders a status tooltip, and this happens withoutdisabledMessagetoo.commitValueis unguarded on main, with or without a reason.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 screenshotsPart of #5941 (ComplexSelector
disabledMessagecheckbox).Rebase onto main (maintainer update)
Rebased onto current main, which changed ComplexSelector since this was opened:
data-testidand other base props now reach the trigger button, a press anywhere in the control box routes through the trigger, andrenderTriggeradds 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. (TherenderTriggerwarning 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.
main. Since this was opened,mainmakes every disabled trigger keep its tab stop witharia-disabledand 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. SodisabledMessagenow adds only the reason tooltip and its description. The trigger, theonClickdocs and the tests followmain: no nativedisabled, no calleronClickwhile disabled, no popup to read before it opens, andaria-busyinstead of a status region.aria-disabledreaches an enabled trigger, per the last review. New test: "keeps a caller's aria-disabled on an enabled trigger". It fails with the trigger overridingaria-disabled.main. The record's Compatibility line and the Changeset also name the one change for callers without the prop: a caller's ownaria-disabledreaches an enabled trigger.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.vitest run packages/core/src/ComplexSelector: 92 passed. Coretsc, eslint,check:knowledge,check:changesetsand 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.
aria-describedbyafter the caller's own, and the tooltip renders beside the popup.tooltip={isDisabled ? undefined : 'Filter'}. The JSDoc, the component doc and the changeset say so. Button is unchanged.aria-describedbyafter its own description. All four fail on the head before the wiring. ComplexSelector and Button suites pass (185 with the shared-context suite); coretsc, ESLint,check:knowledge,check-use-clientand the component import-boundary check pass.Writing rubric results
Run over the
ComplexSelector.spec.mdedits (FR13, thedisabled reasonvariation row, the FR13 verification row, and the Compatibility line).proposes,we decided,previously,a port of,now,used toandbeforefinds nothing.#followed by digits,/pull/and/issues/finds no matches.