Repository navigation
fix(Typeahead): a Typeahead result that renderItem returns as a TypeaheadItem with isDisabled, in its usual layout, is announced as disabled and never picked #11833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
6c2436b
950e76c
a7ae9fe
14e0f24
7270ae2
40c0f47
cd64420
d0cbf92
3cb4e1f
3c16d0b
9b4ef19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Typeahead: a Typeahead result rendered with `TypeaheadItem` and `isDisabled`, in its usual layout (not `item.element`), is now announced as disabled, and Enter, click or tap on it picks nothing and leaves the list open, also inside a shadow root. The pointer does not highlight it; arrow keys still reach it. | ||
|
|
||
| @cixzhang |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ review_triggers: [public-api, theming] | |
| verified_by: | ||
| [ | ||
| packages/core/src/Typeahead/TypeaheadItem.test.tsx, | ||
| packages/core/src/Typeahead/BaseTypeahead.test.tsx, | ||
| apps/storybook/rtl-audit/targets.json, | ||
| ] | ||
| modules: [] | ||
|
|
@@ -31,11 +32,11 @@ system_specs: [] | |
| | Area | Contract | | ||
| | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Public contract | The default Typeahead result content: `item` (required), `icon`, `description`, `isDisabled`, `group`, root inputs, and a ref. | | ||
| | Behavior | Renders an optional icon, the item's label, and an optional description under the `typeahead-item` target; dims when disabled; renders `item.element` raw instead when the item carries one. | | ||
| | Behavior | Renders an icon, the item's label, and a description under the `typeahead-item` target; dims when disabled and marks its option disabled; renders `item.element` raw when the item sets one. | | ||
| | End-user impact | People see each result's label, icon, and supporting text in one consistent row layout. | | ||
| | Builder impact | Builders reuse it inside a custom `renderItem` to keep the default layout and target. | | ||
| | Compatibility/readiness | Records shipped behavior; no API, default, or DOM change. Root inputs dropped on the `item.element` path are listed under Current-state impact. | | ||
| | Review checks | Reject a lost `typeahead-item` target, a description element when none is given, or option semantics added to this content. | | ||
| | Compatibility/readiness | A disabled item marks its option `aria-disabled` and is never picked; no API or other DOM change. Root inputs dropped on the `item.element` path are listed under Current-state impact. | | ||
| | Review checks | Reject a lost `typeahead-item` target, a description element when none is given, or option semantics added to this content beyond the disabled mark. | | ||
| | Governing rules | `architecture:public-component-api` INV5, INV6; `architecture:component-theming-surface`; `component:BaseTypeahead` for the option row around it. | | ||
|
|
||
| This table is a review projection; the body below is authoritative. | ||
|
|
@@ -48,8 +49,9 @@ label-and-supporting-content layout. | |
| ## Compatibility and migration | ||
|
|
||
| - Released default preserved: yes. | ||
| - Compatibility class: records shipped behavior; no public prop, default, | ||
| export, or DOM change. | ||
| - Compatibility class: additive; a disabled item marks its option | ||
| `aria-disabled` and the option is never picked; no public prop, export, or | ||
| other DOM change. | ||
| - Controlled/uncontrolled behavior: not applicable. | ||
| - Migration decision: none. | ||
|
|
||
|
|
@@ -75,14 +77,14 @@ Consumer migration instructions belong in consumer docs and release notes. | |
| | Concept | Closed values or states | Meaning | Availability | Default | Owner | Stability | Invalid-value behavior | | ||
| | -------------- | ------------------------------ | --------------------------------------------------- | -------------- | -------------- | --------- | --------- | ---------------------- | | ||
| | Content source | default layout; `item.element` | Whether the item's own element replaces the layout. | Every result | default layout | component | stable | `item.element` wins. | | ||
| | Availability | enabled; disabled | Whether the content is dimmed. | Default layout | enabled | component | stable | Not applicable. | | ||
| | Availability | enabled; disabled | Dimmed, its option marked disabled, never picked. | Default layout | enabled | component | stable | Not applicable. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking: FR2 limits the mark to a Typeahead result that renders as TypeaheadItem, but this row (availability "Default layout") and the Disabled state row below say every disabled default-layout item has its option marked and never picked. Add "as a Typeahead result". |
||
|
|
||
| ## Behavioral and layout contract | ||
|
|
||
| | ID | Invariant | Basis | | ||
| | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | | ||
| | FR1 | Without `item.element`, the content renders `icon` before a column of the item's `label` and, when given, `description`; no description element renders without one. | Current source and tests | | ||
| | FR2 | The root carries the `typeahead-item` target; `isDisabled` dims it to half opacity. | `architecture:component-theming-surface`; current source and tests | | ||
| | FR2 | The root carries the `typeahead-item` target; `isDisabled` dims it. In a Typeahead result option, without `item.element`, it marks that option `aria-disabled` and the option is never picked. In another host's option, or with `item.element`, it marks nothing. | `architecture:component-theming-surface`; current source and tests | | ||
| | FR3 | Root inputs reach the root: `className` merges with the component's classes, `style` and `xstyle` compose, other props pass through, and the ref reaches the root element. | `architecture:public-component-api`; current tests | | ||
| | FR4 | With `item.element`, that element renders raw in place of the layout. Caller root inputs MUST still reach the rendered root (`architecture:public-component-api` INV5, INV6). Implementation gap: on this path the ref, `className`, `style`, `xstyle`, and other props are dropped. | `architecture:public-component-api` INV5, INV6; current source and tests | | ||
|
|
||
|
|
@@ -97,7 +99,7 @@ Consumer migration instructions belong in consumer docs and release notes. | |
| | ------------------------- | ----------------------------------- | ----------------- | | ||
| | Label only | Label, no description element. | Label text. | | ||
| | With icon and description | Icon, then label above description. | Content. | | ||
| | Disabled | Dimmed to half opacity. | — | | ||
| | Disabled | Dimmed; option disabled; unpicked. | — | | ||
| | `item.element` | The element renders raw. | Caller content. | | ||
|
|
||
| ### Transformation and precedence order | ||
|
|
@@ -111,8 +113,12 @@ Consumer migration instructions belong in consumer docs and release notes. | |
|
|
||
| ## Accessibility contract | ||
|
|
||
| - **AR1 — Content only.** TypeaheadItem adds no role or state; the option row | ||
| around it owns them. | ||
| - **AR1 — Content, plus the disabled mark.** TypeaheadItem adds no role; the | ||
| option row around it owns its role and state. The one exception is | ||
| `isDisabled` inside a Typeahead result option: it marks that option | ||
| `aria-disabled`, so the option is announced as disabled, and BaseTypeahead | ||
| reads the mark at pick time. Another host's option gets no mark, because | ||
| that host does not refuse the pick. | ||
|
|
||
| ## Design relationships | ||
|
|
||
|
|
@@ -137,10 +143,10 @@ carries no anatomy-theming map. | |
| | Contract | Verification | Representative states | Mutation or failure expectation | Audit section | | ||
| | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | | ||
| | FR1 | `TypeaheadItem.test.tsx` "renders the item label", "renders the description below the label when provided", "renders no description element when none is provided", "renders the icon before the label content" | Label, description, icon | A missing label, description, or icon, an extra description element, or the icon after the label fails. | `audit:TypeaheadItem/anatomy` | | ||
| | FR2 | `TypeaheadItem.test.tsx` "dims the row when isDisabled is set" and "does not dim the row by default" | Enabled and disabled | Missing or default dimming fails. Evidence gap: no test asserts the `typeahead-item` class. | `audit:TypeaheadItem/theming` | | ||
| | FR2 | `TypeaheadItem.test.tsx` dimming cases and "marks no option outside a Typeahead result list"; `BaseTypeahead.test.tsx` "a disabled TypeaheadItem result" cases | Enabled and disabled | Missing or default dimming fails. Evidence gap: no test asserts the `typeahead-item` class. | `audit:TypeaheadItem/theming` | | ||
| | FR3 | `TypeaheadItem.test.tsx` "forwards pass-through props to the item element", "merges a caller className with its own classes", "forwards ref to the row element" | Pass-through, className, ref | A dropped prop, class, or ref fails. Evidence gap: no test asserts `style` or `xstyle`. | `audit:TypeaheadItem/api` | | ||
| | FR4, ORD1 | `TypeaheadItem.test.tsx` "renders item.element raw in place of the label layout" | `item.element` | An element that keeps the default layout fails. Evidence gap: no test asserts the root inputs on this path (the FR4 gap). | `audit:TypeaheadItem/api` | | ||
| | PR1, AR1 | Evidence gap: no test asserts the absence of lifecycle resources or roles | — | — | `audit:TypeaheadItem/behavior` | | ||
| | PR1, AR1 | PR1: evidence gap, no test of lifecycle resources. AR1: the FR2 row's `BaseTypeahead.test.tsx` cases | — | — | `audit:TypeaheadItem/behavior` | | ||
| | RTL relation (FR1) | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `Typeahead / Parts / TypeaheadItem with icon` (results opened) | Icon, label and description in an open result; LTR and RTL | A result icon that is not at the inline start of its content fails D2. | `audit:TypeaheadItem/i18n-rtl` | | ||
|
|
||
| ## Current-state impact | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.