An open source design system that's fully customizable and agent ready
TypeScript
fix(PowerSearch): Clear all keeps read-only filters (#9676)
Xinzi Zhou2c533501a517
diff --git a/.changeset/powersearch-clear-all-keeps-read-only.md b/.changeset/powersearch-clear-all-keeps-read-only.mdnew file mode 100644index 0000000000..0736a82f32--- /dev/null+++ b/.changeset/powersearch-clear-all-keeps-read-only.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] `PowerSearch`: Clear all keeps read-only filters. It removes only the filters the user can edit, the clear button shows only while an editable filter exists, Backspace on an empty input no longer removes a read-only filter, and Clear all announces "Editable filters removed" while a read-only filter remains. For callers, Clear all now calls `onChange` with the read-only filters and `remove` at the first removed index (`0` when no filter is read-only) instead of `[]` at the last filter's index.++@imdreamrunnerdiff --git a/docs/specs/components/PowerSearch/PowerSearch.spec.md b/docs/specs/components/PowerSearch/PowerSearch.spec.mdindex 66f32a37b3..c1d3e2dca6 100644--- a/docs/specs/components/PowerSearch/PowerSearch.spec.md+++ b/docs/specs/components/PowerSearch/PowerSearch.spec.md@@ -95,6 +95,14 @@ present-tense implementation gap note.removing filters", no prop, `onChange` shape, or rendered text changes, andno valid consumer relies on a read-only field losing a filter. It ships as a`[fix]` patch release.+- A third stable fix, outside the experimental exception: in the `popover`+ presentation, Clear all keeps read-only filters, reports `remove` at the+ first removed index, and shows only while an editable filter exists, and+ Backspace keeps a read-only filter (FR23). It is a `[fix]` (DEC-4): a+ read-only filter is non-removable by contract, so "all filters" in Clear+ all means every removable filter, and a Clear all that removes a read-only+ filter is a defect. `onChange` documents `index` as the affected position,+ which the first removed index is. It ships as a `[fix]` patch release.Consumer migration instructions belong in consumer docs and release notes.@@ -180,7 +188,7 @@ Current requirements identify their basis and distinguish accepted contract fromimplementation status. The contract is authoritative; the behavior remains unshippeduntil its implementation and verification complete.-FR1–FR9 and FR22 govern the `popover` presentation — the tokenizer field and its editor+FR1–FR9, FR22, and FR23 govern the `popover` presentation — the tokenizer field and its editorpopover, rendered when `experimental` is omitted or resolves to `popover`. Theeditor popover does not render in the `bottom-sheet` presentation, whose surfaceFR10–FR21 govern.@@ -198,7 +206,7 @@ FR10–FR21 govern.| FR9 | In the `popover` presentation, the opening-control descriptor owned by `component:Tokenizer/DEC-1` and consumed by PowerSearch MUST remain package-internal. PowerSearch MUST NOT add a public width, maximum-width, input-ref, or positioning prop for this behavior. | `component:Tokenizer/DEC-1`, `architecture:public-component-api`, and `component:PowerSearch/DEC-1` | Accepted contract; implementation pending || FR10 | `experimental.presentation` selects the surface. `popover`, the value when `experimental` or the option is omitted, is the tokenizer field with its typeahead and editor popover, unchanged except as FR19 (no mount announcement) states. `bottom-sheet` is the trigger and sheet flow of FR11–FR21 on every device. `adaptive` resolves to `bottom-sheet` on compact coarse-pointer screens and to `popover` otherwise, through the same shared resolution the selection controls use (`component:Selector/FR4`). That resolution answers `popover` on the server and during the hydrating render, so an `adaptive` field server-renders as, and hydrates without a mismatch as, the popover presentation's tokenizer field; on a compact coarse-pointer screen the first client render after hydration swaps it to the trigger. Focus follows the resolution rule below: before any interaction nothing in the field has focus and nothing moves, except that with `hasAutoFocus` the server markup's `autofocus` has focused the combobox input, and the swap then moves focus to the trigger within the same visit — the caller is told of neither a blur nor a new focus. The two closed fields share the field's wrapper, border, and minimum height for the size, and show the same tokens, but their row counts may differ: the popover field's editable tokens each carry a 16 px remove control the trigger's display-only tokens do not (FR11), so the trigger's tokens can wrap into fewer rows (seven filters in a 326 px field take seven rows editable and six as display-only tokens), and the popover field also carries its inline combobox input after the tokens, which may take a row of its own — the swap then changes the field's height by those rows (none on the measured story at 390 px, one token row at 414 px). A resolution change while the flow is open takes effect after it closes and focus has returned to the trigger (the focus the close reports, FR11) — the presentation hold `architecture:layer-runtime/INV14` assigns to the layer runtime; INV14 gap: the runtime does not yet provide one (its record names INV14 as ownership not yet met), so until it does the field keeps its own hold, to be replaced by the runtime's when it exists; when the new presentation is `popover`, focus then moves to the tokenizer's combobox input as the same visit — no `onBlur` and no second `onFocus` reaches the caller. A resolution change while the flow is closed takes effect at once; when focus is anywhere inside the closed field — the trigger, the combobox input, a token or its remove control, the clear control, or an interactive `endContent` — and the focused element does not survive the switch, focus moves to the other presentation's primary control (the combobox input, or the trigger) as a continuation of the same visit — no `onBlur` and no `onFocus` reaches the caller for the hand-off; when the focused element survives, or focus is outside the field, focus stays where it is. When the switch to the sheet presentation happens while the popover presentation's editor popover is open, the popover and its focused control unmount with the tokenizer field, and focus moves to the trigger. Focus never lands on the page body. | DEC-3; touch-flow evidence from the Lab prototype | Current contract. Implementation gap: the shipped PowerSearch has no `experimental` prop and renders the tokenizer field on every device. || FR11 | In the sheet presentation the field's control is one trigger: a button with `aria-haspopup="dialog"` and `aria-expanded`, whose accessible name is the field label followed by the trigger's visible text — the placeholder while no filter exists, otherwise the text of the filter tokens — so the name contains what is visible and exposes the selected filters. The tokens are display-only — each is the token's static structure (`component:Token/FR2`): no remove control, no click of its own, no inner control inside the trigger button — and the tokens, the placeholder, and the empty space around them belong to the trigger: a tap on any of them opens the flow. Tokens wrap onto further lines; the trigger does not reserve a row of its own once a token exists. The trigger's tokens are the popover presentation's tokens: the same component, the same words for a value, and the same zone handling, so a value reads on the trigger exactly as it reads on the tokenizer field. A `components[type].Token` override renders on the trigger in place of PowerSearch's token, receiving the props the popover presentation hands it — `config`, `filter`, `field`, `operator`, `maxLength`, `isDisabled` — with `onClick` and `onRemove` undefined, as the popover hands them for a read-only filter: the trigger's tokens are display-only, and the override formats its own value. `startIcon` renders in the trigger's lane. The result count and `endContent` render in the field's end lane, outside the trigger button and after it: an interactive `endContent` keeps its own tab stop, its own taps, and its own accessible name, and a tap on it does not open the flow, so a caller's control is never nested inside the component's button and the end lane's text is not part of the trigger's name. `size` sizes the trigger field and its tokens as it sizes the tokenizer field; `statusVariant` places `status.message` as the popover presentation places it; `hasAutoFocus` focuses the trigger on mount. `onFocus` fires when focus enters the field from outside and `onBlur` when it leaves the field: opening the flow moves focus into a sheet, outside the field, so `onBlur` fires, and the close that returns focus to the trigger fires `onFocus` — as the popover presentation fires them around its editor. While disabled the trigger stays focusable with `aria-disabled="true"`, never carries the native `disabled` attribute, does not open, and shows `disabledMessage` as the field does (`spec:AST-085/FR1`, `FR2`). When the component becomes disabled with the flow open, the flow closes and focus moves to the trigger, the destination this record names (`spec:AST-085/FR4`). | DEC-3; Lab touch-flow evidence; `spec:AST-085`; WCAG 2.5.3 | Current contract. Implementation gap: no trigger exists. |-| FR12 | Opening the flow from a field with at least one filter, or from a read-only field, shows the Filters sheet, a tall modal sheet named "Filters": a heading, an Add filter action in the header while the field is interactive, one row per filter showing "{field label} {operator label}" (one catalog message, so a locale can reorder it) and, in bold, the value as the popover presentation's token shows it — the same function, so the same words and the same zone handling, with the token's width budget lifted: the row never truncates a single value and never collapses a list to its "{n} items" count, both of which the token does once a value's text outgrows its width — with the token's summaries resolved from the catalog (`@astryx.powersearch.valueEditor.dateRange`, `itemsCount`, `filtersCount`, ICU plurals), so in English a row reads as the token does and another locale translates it: an `integer` or `float` value reads as the token's own text (`String(value)`: `2.3456`, `1e+21`, `1e-7`, and `0` for negative zero) wherever the locale writes numbers with the token's numerals — Latin digits and a `.` decimal mark — and elsewhere with the locale's digits and decimal mark, no grouping and no rounding, so that it differs from the token only in notation (`0,0000001`, `-0`); a `string_list`, `enum_list`, or `entity_list` value reads as all of its items joined by the locale's narrow conjunction list (`Intl.ListFormat`, `{type: 'conjunction', style: 'narrow'}` — "Open, Closed" in English, "高、中" in Simplified Chinese and Japanese, "A, B und C" in German): a conjunction list keeps every item separated in every shipped locale, where the `unit` type runs some together, and of the conjunction styles the narrow one is the one that reads in English exactly as the token's ", " join does; a `date_absolute` value reads as a day with no time, a `date_range` as "date range", a `nested` value as "{n} filters", and a `date_relative` value as the value step's choice row reads it ("3 days ago", FR20) when a choice matches the stored value, otherwise as stored (the value is any string; the token always shows it as stored) — and a footer with Done and, while `hasClear` is set, the field is interactive, and at least one filter exists, Clear all. A row's label and value are one catalog message, "{label} {value}", the same message the removal announcement of AR6 uses, with the value segment bold, so a locale that reorders it reorders both. A filter the field can edit is a row button with a trailing chevron; a read-only filter, or every filter while the field is read-only, is a plain row, as the popover gives such a token no remove control. A `nested` filter's row is a row button like any other; its step edits the group with the popover presentation's built-in nested editor (FR14). An editable filter whose field or operator the config no longer has — which the trigger still shows as a token — lists as a row button reading the field's label when the config still has the field and the raw key for whatever is gone — "{field key} {operator key}" when both are, "{field label} {operator key}" when only the operator is — that opens the step's "This filter is no longer available" state, where Remove is the way out, as the popover's token removal is; it is a plain row while the filter, or the field, is read-only. With no filter the body shows "No filters selected". Done closes the flow. Clear all commits `onChange([], 'remove', <index of the last filter>)` — the same change the popover presentation's clear control commits, read-only filters included — and closes the flow. After the flow closes focus returns to the trigger. | DEC-3; Lab touch-flow evidence; current popover clear semantics | Current contract. Implementation gap: no Filters sheet exists. |+| FR12 | Opening the flow from a field with at least one filter, or from a read-only field, shows the Filters sheet, a tall modal sheet named "Filters": a heading, an Add filter action in the header while the field is interactive, one row per filter showing "{field label} {operator label}" (one catalog message, so a locale can reorder it) and, in bold, the value as the popover presentation's token shows it — the same function, so the same words and the same zone handling, with the token's width budget lifted: the row never truncates a single value and never collapses a list to its "{n} items" count, both of which the token does once a value's text outgrows its width — with the token's summaries resolved from the catalog (`@astryx.powersearch.valueEditor.dateRange`, `itemsCount`, `filtersCount`, ICU plurals), so in English a row reads as the token does and another locale translates it: an `integer` or `float` value reads as the token's own text (`String(value)`: `2.3456`, `1e+21`, `1e-7`, and `0` for negative zero) wherever the locale writes numbers with the token's numerals — Latin digits and a `.` decimal mark — and elsewhere with the locale's digits and decimal mark, no grouping and no rounding, so that it differs from the token only in notation (`0,0000001`, `-0`); a `string_list`, `enum_list`, or `entity_list` value reads as all of its items joined by the locale's narrow conjunction list (`Intl.ListFormat`, `{type: 'conjunction', style: 'narrow'}` — "Open, Closed" in English, "高、中" in Simplified Chinese and Japanese, "A, B und C" in German): a conjunction list keeps every item separated in every shipped locale, where the `unit` type runs some together, and of the conjunction styles the narrow one is the one that reads in English exactly as the token's ", " join does; a `date_absolute` value reads as a day with no time, a `date_range` as "date range", a `nested` value as "{n} filters", and a `date_relative` value as the value step's choice row reads it ("3 days ago", FR20) when a choice matches the stored value, otherwise as stored (the value is any string; the token always shows it as stored) — and a footer with Done and, while `hasClear` is set, the field is interactive, and at least one editable filter exists, Clear all. A row's label and value are one catalog message, "{label} {value}", the same message the removal announcement of AR6 uses, with the value segment bold, so a locale that reorders it reorders both. A filter the field can edit is a row button with a trailing chevron; a read-only filter, or every filter while the field is read-only, is a plain row, as the popover gives such a token no remove control. A `nested` filter's row is a row button like any other; its step edits the group with the popover presentation's built-in nested editor (FR14). An editable filter whose field or operator the config no longer has — which the trigger still shows as a token — lists as a row button reading the field's label when the config still has the field and the raw key for whatever is gone — "{field key} {operator key}" when both are, "{field label} {operator key}" when only the operator is — that opens the step's "This filter is no longer available" state, where Remove is the way out, as the popover's token removal is; it is a plain row while the filter, or the field, is read-only. With no filter the body shows "No filters selected". Done closes the flow. Clear all commits the same change the popover presentation's clear control commits (FR23) — read-only filters stay, with `remove` at the first removed index — and closes the flow. After the flow closes focus returns to the trigger. | DEC-3; Lab touch-flow evidence; current popover clear semantics | Current contract. Implementation gap: no Filters sheet exists. || FR13 | Add filter — from the Filters sheet's header, or directly when an interactive field with no filter opens — is a tall modal sheet named "Add filter" with a Back action. Without a content-search field it lists the visible fields grouped by `group` (ungrouped first, each group a named list), each a row button with the field's icon and a trailing chevron, and, once the field count reaches eight, a "Search filters" field above the list that matches labels and `typeaheadAliases` case-insensitively, caps a non-empty query's matches at `maxSearchResults`, and shows "No filters match your search" when nothing matches. With a `contentSearchFieldKey` whose default operator takes a `string` value it shows instead a "Search" searchbox using `placeholder`, focused on arrival, with the same suggestions the popover presentation's typeahead offers listed inline as row buttons ("Search results"): fields, field-and-operator pairs, value matches, and a leading free-text item for the content field; Enter commits the first suggestion, ArrowDown and ArrowUp move between the search and the rows — arrow movement across independently focusable controls, recorded here as this record's exception to `spec:AST-020/FR15`, which adopts arrow keys for a single composite only: the searchbox-to-list continuity is what the popover presentation's combobox gives the same suggestions, and the rows stay in the Tab order as well — an IME-composing Enter does nothing, and a query with no suggestion shows "No results found" — the searchbox's `aria-controls` names the results list, or that message while nothing lists, so it always names an element; the field list's "No filters match your search" likewise shows only for a non-empty query that matches nothing, never for a config with no field. A suggestion that carries a value commits `onChange([...filters, filter], 'add', filters.length)`, announces `Added {label}` through the flow's own polite region (AR6), and returns to the Filters sheet; any other suggestion or field row opens the value step with that field and operator. Back returns to the Filters sheet, or closes the flow when the sheet was the entry point. Every visible field lists, a field whose every operator is `nested` included: the value step edits every operator's value (FR14). | DEC-3; Lab touch-flow evidence; current typeahead source | Current contract. Implementation gap: no Add filter sheet exists. || FR14 | The value step is a tall modal `form` sheet that edits every operator's value; its title is the dialog's name (AR5), and for a filter whose field or operator the config no longer has it reads as the Filters row does (FR12): the field's label when the config still has the field, the raw key for whatever is gone. When the field offers more than one operator the body starts with an "Operator" radio group whose options read "{field label} {operator label}" and list the field's operators, with the operator the step opened with checked — the filter's operator while editing, and while creating the operator the suggestion named (FR13) or else the field's default operator, else its first; otherwise there is no group and the title is "{field label} {operator label}" naming that operator. When no operator label applies the title is the field label. The body below the group is the editor for the checked operator's value type: the sheet-native controls of FR17, or for a `nested` value the popover presentation's built-in nested editor — the sub-filter tree with its Add action, each sub-filter's field, operator, and value controls, and removal — rendered as the popover renders it, with one difference: the step's Operator group takes the place of the editor's root group-operator picker, which is not shown, and the tree root reads the checked operator's label; a sub-filter's controls are the popover editor's own, in their default presentation (a Selector's menu, the Tokenizer's inline field), not the sheet's choice rows (FR17) or Tokenizer sheet (FR21), which govern the step's top-level value only, because the sheet passes no `experimental` option down to them; the tree is its own width container, so below 400 CSS px its rows wrap instead of overflowing the sheet, as they wrap in a narrow popover. A group is created and edited the same way in both presentations; switching the operator swaps the body. A value chosen in the body is staged, not committed: no `onChange` fires until the footer confirms it. Changing the operator keeps a staged value only when the new operator reads the same value type; an `empty` operator stages `{type: 'empty'}`. The footer holds Cancel and the confirm action — `popoverSaveButtonLabel` when given, otherwise "Add filter" while creating and "Apply" while editing — disabled until the staged value is complete, plus Remove while editing. When `components[type].Editor` is set for the checked operator's value type it replaces the body below the Operator group and the footer — the group stays outside it, so switching operators still swaps the body — receiving the props the popover presentation hands it, with the same meaning: the caller's `config`, the partial `filter`, `mode`, `saveButtonLabel`, `isReadOnly`, `onSave`, and `onCancel`, and nothing the popover does not pass; `onSave(filter)` commits it, `onSave(null)` removes the filter while editing and returns to Filters unchanged while creating. A controlled update that removes the field or operator being edited replaces the body with "This filter is no longer available", announced from its rendered element inside the sheet (AR6), and keeps Remove (while editing) and Cancel as the ways out; when focus was on a control of the replaced body it moves to Remove, else to Cancel, so it never falls to the page body inside the open sheet (FR16). | DEC-3; Lab touch-flow evidence | Current contract. Implementation gap: no value step exists. || FR15 | Confirming a created filter commits `onChange([...filters, filter], 'add', filters.length)`. Tapping an editable Filters row opens the value step on that filter in edit mode; Apply commits `onChange(updated, 'edit', index)` and Remove commits `onChange(rest, 'remove', index)`, where `index` is the filter's position at commit time: a controlled parent that reorders or clones its filters while the step is open is followed by object identity, then by a structurally equal filter in the original slot, then by a unique structural match; when the target is gone or ambiguous nothing is committed and the flow returns to the Filters sheet, focus landing as FR16 states for a row that no longer exists. Every commit returns the flow to the Filters sheet. While the field is read-only, or disabled, no commit happens. | DEC-3; Lab touch-flow evidence | Current contract. Implementation gap: no edit path exists. |@@ -209,6 +217,7 @@ FR10–FR21 govern.| FR20 | Every string the sheets introduce comes from the `@astryx.powersearch.*` catalog, reusing the existing editor keys where their meaning fits (Cancel, Apply, Operator, Value, Values, Entities, the placeholders, the result count). Content the popover presentation already renders keeps its source — field, operator, and value text from the config and its formatters — except that every label the sheets render for a generated choice comes from the catalog as one ICU message with a plural: the relative-date choice rows (`@astryx.powersearch.sheet.relative{Days,Weeks,Months}{Ago,FromNow}`, the same choices and, in English, the same words as the popover's editor lists) and the value summaries of FR12. | DEC-3; catalog contract | Current contract. Implementation gap: no sheet strings exist. || FR21 | A `string_list` or `entity_list` value inside the value step opens the Tokenizer's sheet above the value step. Escape and swipe dismiss only that topmost sheet; closing it returns focus to its trigger inside the value step; the value step keeps its staged state. | DEC-3; `family:overlay-dismissal`; `component:Tokenizer/FR18` | Current contract. Implementation gap: no nested sheet exists. || FR22 | In the `popover` presentation, a read-only field (`isReadOnly`) MUST NOT remove a filter: it shows no Clear all, no token has a remove control, and Backspace on an empty input removes nothing. | The `isReadOnly` prop docs: "Prevent adding, editing, or removing filters." | Current contract |+| FR23 | In the `popover` presentation, Clear all MUST remove every editable filter and keep every read-only filter: it commits `onChange(<the read-only filters>, 'remove', <index of the first removed filter>)` and announces "Editable filters removed" while a read-only filter remains, otherwise "All filters removed". The clear control MUST render only while `hasClear` is set, the field is neither read-only nor disabled, and at least one editable filter exists. Backspace on an empty input MUST NOT remove a read-only filter; its token has no remove control. | DEC-4; a read-only filter's token has no remove control (current source) | Current contract |### Allowed variation@@ -360,14 +369,16 @@ FR10–FR21 govern.polite urgency (`spec:AST-086/FR4`), and that is the route an owner inside anopen native modal takes (`spec:AST-086/FR14`), so the announcement reachesassistive technology behind the native modal dialog where a channel outside- it does not. Clear all closes the flow and announces "All filters- removed" once the sheet's dialog has finished its exit and focus is back on+ it does not. Clear all closes the flow and announces its FR23 words ("All+ filters removed", or "Editable filters removed" while a read-only filter+ remains) once the sheet's dialog has finished its exit and focus is back onthe trigger — not before, since the closing dialog stays modal through itsexit and hides both its own region and the channel outside it — through theroute `spec:AST-086/FR14` names for the field's position then: the modalthat holds the field, or the shared channel when none does. A result count that changes while the flow isclosing (Clear all's commit) waits the same way and the two are spoken as one- catalog message, "All filters removed. {result count}", so a locale orders+ catalog message per wording, "All filters removed. {result count}" or+ "Editable filters removed. {result count}", so a locale ordersand punctuates the pair; while the flow is closed the result count takes thesame FR14 route (FR19). Focus moves as FR16 states and returns to thetrigger after the flow closes. Implementation gap: no flow exists.@@ -472,7 +483,8 @@ mark implementation and focused real-Chromium verification as pending.| PR1–PR4 | Instrumented unit tests plus first-frame real-Chromium capture | Open, close, reopen opposite side; hidden placement commit; first painted frame | Render-time reads, repeated reads, observers, pointer tracking, or a default-position flash fails. | `audit:PowerSearch/performance` || FR8, AR1–AR3 | Existing PowerSearch/editor suites plus focused browser checks | Pointer and keyboard edit, apply, cancel, Escape, light dismiss, focus return, selection, semantics | Focus, semantics, selection, dismissal, or reachability changes fail. | `audit:PowerSearch/accessibility` || FR22 | PowerSearch and Tokenizer unit tests | A read-only field with a filter: no Clear all, no token remove control, Backspace on the empty input | A read-only field removes a filter through Backspace, Clear all, or a token control. | `audit:PowerSearch/interaction` |-| FR10–FR21, AR4–AR6, PR5 | Focused PowerSearch sheet tests with the compact-touch query stubbed both ways, plus real-engine touch evidence (implementation gap: not yet in the tree) | default popover, forced sheet, adaptive both ways (server markup and hydration as the popover field on a coarse-pointer client, then the trigger, no recoverable error, focus on the body; with `hasAutoFocus`, the autofocused input's focus ending on the trigger with no `onBlur` or `onFocus` to the caller), trigger name, Filters/Add filter/value steps, each value type, list value through the Tokenizer sheet, Clear all, read-only, disabled while open, focus after each step, focus after an `adaptive` switch from the trigger, the input, a removed control, an open editor popover, and from outside the field, a field inside an open Dialog announcing the count, Clear all, and in-sheet messages inside that Dialog and never on the page body, StrictMode result count, in-sheet live region while a sheet is open (added, removed, count, empty results), Clear all announced only after the dialog's exit, row, token and Removed text equal to the popover token's value text (UTC, Tokyo, Honolulu, unset), summaries and relative-date labels and values from the catalog, the row and Removed through one reorderable message, an unmatched relative-date value as stored, a filter the config no longer knows listed and removable, a cleared number unstaged, choice rows as radios and checkboxes with `aria-checked`, a stale read-only filter as a plain row, a removal next to a nested row focusing that row, a nested filter removed from its step, a list value joined by the locale's narrow conjunction list in English, Simplified Chinese, Japanese, and German, an empty-result message spoken once per query from its rendered element, a controlled update that removes the edited field moving focus from the replaced body to Remove and announcing the unavailable state in the sheet, Apply and Cancel after a controlled update removed the edited filter focusing the nearest row, else Add filter, a stale filter's step titled as its row reads (raw keys for what is gone, the field's label when the field remains), Cancel from creation after the opening field was removed focusing the Add filter sheet's first control, a removed focused Filters row, a removed Clear all, and a dropped focused field row each handing focus to the nearest remaining row or the sheet's first control, element counts at rest and with each of the Filters, Add filter and value sheets open, and with the Tokenizer's list-value sheet stacked above the value step, under fine and coarse pointers, nothing of the flow in the DOM at rest before a press and after the exit, a nested filter edited and created through the built-in nested editor (its sub-filter rows wrapping inside a 390 and a 414 px sheet; its root operator picker absent on a mixed field, the Operator group in its place), a nested-only field and its suggestion offered, a suggestion's operator checked over the field's default, the Operator group outside a caller's Editor override on a mixed field, a count changed during the exit spoken with Clear all's message as one catalog message after the close, a radio group's arrow keys, Home, and End moving and checking, Space and Enter checking a focused radio row and toggling a checkbox row, right-to-left layout with the row chevrons and Back glyph mirrored (`design:bidirectionality/DR4`) | A field without `experimental` changes beyond what FR19 states, a value commits before the step confirms, Clear all skips a read-only filter, the trigger carries native `disabled`, focus lands elsewhere, an announcement reaches a channel outside the modal that holds the field at that moment, or the popover bundle carries the sheets. | `audit:PowerSearch/sheet` |+| FR23 | PowerSearch and Tokenizer unit tests | Clear all with a read-only filter before two editable ones; every filter read-only; Backspace with a read-only last filter; the words with and without a read-only filter left | A read-only filter is removed, Clear all reports an index other than the first removed one, Clear all shows with no editable filter, or its words say every filter went while one remains. | `audit:PowerSearch/interaction` |+| FR10–FR21, AR4–AR6, PR5 | Focused PowerSearch sheet tests with the compact-touch query stubbed both ways, plus real-engine touch evidence (implementation gap: not yet in the tree) | default popover, forced sheet, adaptive both ways (server markup and hydration as the popover field on a coarse-pointer client, then the trigger, no recoverable error, focus on the body; with `hasAutoFocus`, the autofocused input's focus ending on the trigger with no `onBlur` or `onFocus` to the caller), trigger name, Filters/Add filter/value steps, each value type, list value through the Tokenizer sheet, Clear all, read-only, disabled while open, focus after each step, focus after an `adaptive` switch from the trigger, the input, a removed control, an open editor popover, and from outside the field, a field inside an open Dialog announcing the count, Clear all, and in-sheet messages inside that Dialog and never on the page body, StrictMode result count, in-sheet live region while a sheet is open (added, removed, count, empty results), Clear all announced only after the dialog's exit, row, token and Removed text equal to the popover token's value text (UTC, Tokyo, Honolulu, unset), summaries and relative-date labels and values from the catalog, the row and Removed through one reorderable message, an unmatched relative-date value as stored, a filter the config no longer knows listed and removable, a cleared number unstaged, choice rows as radios and checkboxes with `aria-checked`, a stale read-only filter as a plain row, a removal next to a nested row focusing that row, a nested filter removed from its step, a list value joined by the locale's narrow conjunction list in English, Simplified Chinese, Japanese, and German, an empty-result message spoken once per query from its rendered element, a controlled update that removes the edited field moving focus from the replaced body to Remove and announcing the unavailable state in the sheet, Apply and Cancel after a controlled update removed the edited filter focusing the nearest row, else Add filter, a stale filter's step titled as its row reads (raw keys for what is gone, the field's label when the field remains), Cancel from creation after the opening field was removed focusing the Add filter sheet's first control, a removed focused Filters row, a removed Clear all, and a dropped focused field row each handing focus to the nearest remaining row or the sheet's first control, element counts at rest and with each of the Filters, Add filter and value sheets open, and with the Tokenizer's list-value sheet stacked above the value step, under fine and coarse pointers, nothing of the flow in the DOM at rest before a press and after the exit, a nested filter edited and created through the built-in nested editor (its sub-filter rows wrapping inside a 390 and a 414 px sheet; its root operator picker absent on a mixed field, the Operator group in its place), a nested-only field and its suggestion offered, a suggestion's operator checked over the field's default, the Operator group outside a caller's Editor override on a mixed field, a count changed during the exit spoken with Clear all's message as one catalog message after the close, a radio group's arrow keys, Home, and End moving and checking, Space and Enter checking a focused radio row and toggling a checkbox row, right-to-left layout with the row chevrons and Back glyph mirrored (`design:bidirectionality/DR4`) | A field without `experimental` changes beyond what FR19 states, a value commits before the step confirms, Clear all drops a read-only filter, the trigger carries native `disabled`, focus lands elsewhere, an announcement reaches a channel outside the modal that holds the field at that moment, or the popover bundle carries the sheets. | `audit:PowerSearch/sheet` || Record structure | `scripts/check-knowledge.mjs` | Component-contract schema and current-authority dependency | Missing or invalid metadata and sections fail repository validation. | `audit:PowerSearch/knowledge` |Current-source Chromium evidence establishes the geometry gap, not implementation@@ -547,8 +559,8 @@ rows; list values edit through the Tokenizer's sheet presentation titled withthe field label; a `nested` value uses the popover presentation's built-innested editor; every other value type uses the editor the popover presentationuses, so a filter reads the same in both presentations of one field. Clear all-keeps the popover presentation's semantics (every filter, `remove` at the last-index). Rejected: switching surfaces automatically on `pointer: coarse` without+keeps the popover presentation's semantics (DEC-4). Rejected: switching+surfaces automatically on `pointer: coarse` withoutan opt-in (changes stable behavior). Rejected: a top-level stable `presentation`prop before the surface has consumer evidence. Rejected: a separate touchcomponent chosen by the caller (two components, two draft states, an import swap@@ -582,10 +594,24 @@ flow), and a combobox cannot be restyled into a dialog trigger without lyingabout its role. The swap renders fewer elements, not more (123 against 166 atrest), and happens only on resolution changes (FR10); the Tokenizer's own`adaptive` trigger records the same exception.-Rejected: sheet-only Clear all semantics that keep read-only-filters (the two presentations of one field would clear differently). Rejected:-sheet-only date editors that read dates in `timezoneID` while the popover's read-them in UTC (one filter would show two days).+Rejected: sheet-only Clear all semantics (the two presentations of one field+would clear differently). Rejected: sheet-only date editors that read dates in+`timezoneID` while the popover's read them in UTC (one filter would show two+days).++### DEC-4 — Clear all keeps read-only filters++**Reference:** `component:PowerSearch/DEC-4`+**Decider:** `imdreamrunner`, 2026-11-02++A read-only filter is non-removable by contract: it has no remove control, and+no key or bulk action removes it either. "All filters" in Clear all therefore+means every removable filter, and a Clear all that removes a read-only filter+is a defect. Clear all removes the editable filters, keeps the read-only ones,+and reports `remove` at the first removed index. Backspace on an empty input+removes nothing when the last filter is read-only (FR23). Rejected: a Clear all+that also removes read-only filters (a filter the person cannot remove alone+would go with the rest).## Open questions@@ -656,8 +682,6 @@ them in UTC (one filter would show two days).owner at once, PowerSearch's calls unchanged.- Should `date_absolute` with `isDateOnly: false` get a date-and-time editor inboth presentations? Today both offer a date-only editor.-- Should Clear all leave read-only filters in place in both presentations? Today- both clear every filter.- The editor geometry contract (DEC-1, DEC-2) is accepted and current; itsimplementation and focused real-Chromium verification remain pending.diff --git a/docs/specs/components/Tokenizer/Tokenizer.spec.md b/docs/specs/components/Tokenizer/Tokenizer.spec.mdindex 5364397429..1201ef2351 100644--- a/docs/specs/components/Tokenizer/Tokenizer.spec.md+++ b/docs/specs/components/Tokenizer/Tokenizer.spec.md@@ -401,7 +401,11 @@ presentation.confirmed in the sheet is announced by the sheet alone (AR6), and the fieldstays silent for it (WCAG 2.2 SC 4.1.3 through `spec:AST-020/FR9`). Acomponent that composes Tokenizer and words its own Clear all announces its- own words instead (`component:PowerSearch`).+ own words instead (`component:PowerSearch`). In the `popover` presentation,+ a component that composes Tokenizer and locks some tokens keeps them: Clear+ all removes only the other tokens and shows only while one exists, and+ Backspace removes nothing while the last token is locked+ (`component:PowerSearch` FR23).## Design relationshipsdiff --git a/packages/core/locales/en.json b/packages/core/locales/en.jsonindex f6cab932d9..72d6f10697 100644--- a/packages/core/locales/en.json+++ b/packages/core/locales/en.json@@ -1123,6 +1123,10 @@"defaultMessage": "All filters removed","description": "Screen-reader announcement after a PowerSearch field's Clear all removes every filter. Distinct from @astryx.tokenizer.allRemoved: PowerSearch words its items as filters."},+ "@astryx.powersearch.editableFiltersRemoved": {+ "defaultMessage": "Editable filters removed",+ "description": "Screen-reader announcement after a PowerSearch field's Clear all removes the filters the user can edit and keeps its read-only filters. Used instead of @astryx.powersearch.allFiltersRemoved while a read-only filter remains."+ },"@astryx.resizable.collapsed": {"defaultMessage": "Collapsed","description": "aria-valuetext for the Resizable drag handle (role=separator) while its panel is collapsed to zero size. Replaces the numeric value announcement, since the numeric value is clamped to the minimum while collapsed. Adjective describing the panel state, not a verb/command."diff --git a/packages/core/src/PowerSearch/PowerSearch.doc.mjs b/packages/core/src/PowerSearch/PowerSearch.doc.mjsindex ebc62daa98..381a3499f1 100644--- a/packages/core/src/PowerSearch/PowerSearch.doc.mjs+++ b/packages/core/src/PowerSearch/PowerSearch.doc.mjs@@ -65,7 +65,7 @@ export const docs = {{name: 'hasClear',type: 'boolean',- description: 'Show a clear-all button for removing all filters.',+ description: 'Show a clear-all button that removes every editable filter. Read-only filters stay.',default: 'true',},{@@ -336,7 +336,7 @@ export const docsZh = {{name: 'hasClear',type: 'boolean',- description: '显示清除全部按钮以移除所有过滤器。',+ description: '显示清除全部按钮,移除可编辑的过滤器,保留只读过滤器。',default: 'true',},{@@ -507,7 +507,7 @@ export const docsDense = {isLabelHidden: 'Visually hides label while keeping accessible.',placeholder: 'Text shown when no filters selected.',hasAutoFocus: 'Auto-focus input on mount.',- hasClear: 'Show clear-all button for removing all filters.',+ hasClear: 'Show clear-all button; removes editable filters, keeps read-only ones.',isReadOnly: 'Prevent adding, editing, or removing filters.',isDisabled: 'Disables entire component.',status: 'Validation status object w/ type + optional message.',diff --git a/packages/core/src/PowerSearch/PowerSearch.test.tsx b/packages/core/src/PowerSearch/PowerSearch.test.tsxindex 95a3e7d25e..094de061f6 100644--- a/packages/core/src/PowerSearch/PowerSearch.test.tsx+++ b/packages/core/src/PowerSearch/PowerSearch.test.tsx@@ -276,6 +276,74 @@ describe('PowerSearch', () => {expect(onChange).not.toHaveBeenCalled();});+ describe('read-only filters', () => {+ const readOnlyFilter: PowerSearchFilter = {+ field: 'status',+ operator: 'is',+ value: {type: 'enum', value: 'open'},+ isReadOnly: true,+ };+ const titleFilter: PowerSearchFilter = {+ field: 'title',+ operator: 'contains',+ value: {type: 'string', value: 'login'},+ };+ const closedFilter: PowerSearchFilter = {+ field: 'status',+ operator: 'is',+ value: {type: 'enum', value: 'closed'},+ };+ const politeRegion = () =>+ document.querySelector('[data-astryx-live-region="polite"]');++ it('Clear all keeps a read-only filter and reports the first removed index', async () => {+ const onChange = vi.fn();+ render(+ <PowerSearch+ config={config}+ filters={[readOnlyFilter, titleFilter, closedFilter]}+ onChange={onChange}+ />,+ );+ fireEvent.click(screen.getByRole('button', {name: 'Clear all'}));+ expect(onChange).toHaveBeenCalledTimes(1);+ expect(onChange).toHaveBeenCalledWith([readOnlyFilter], 'remove', 1);+ await waitFor(() => {+ expect(politeRegion()).toHaveTextContent('Editable filters removed');+ });+ expect(politeRegion()).not.toHaveTextContent('All filters removed');+ });++ it('has no Clear all when every filter is read-only', () => {+ render(+ <PowerSearch+ config={config}+ filters={[readOnlyFilter]}+ onChange={() => {}}+ />,+ );+ expect(+ screen.queryByRole('button', {name: 'Clear all'}),+ ).not.toBeInTheDocument();+ });++ it('Backspace on an empty input keeps a read-only last filter', async () => {+ const user = userEvent.setup();+ const onChange = vi.fn();+ render(+ <PowerSearch+ config={config}+ filters={[titleFilter, readOnlyFilter]}+ onChange={onChange}+ />,+ );+ await user.click(screen.getByRole('combobox', {name: 'Search'}));+ await user.keyboard('{Backspace}');+ expect(onChange).not.toHaveBeenCalled();+ expect(politeRegion()?.textContent ?? '').not.toMatch(/removed/i);+ });+ });+describe('token value truncation (#4759)', () => {it('truncates token values by characters, not code units', () => {const truncConfig: PowerSearchConfig = {diff --git a/packages/core/src/PowerSearch/PowerSearch.tsx b/packages/core/src/PowerSearch/PowerSearch.tsxindex 2e0eaed55d..0917c28494 100644--- a/packages/core/src/PowerSearch/PowerSearch.tsx+++ b/packages/core/src/PowerSearch/PowerSearch.tsx@@ -62,6 +62,7 @@ import {themeProps} from '../utils/themeProps';import {truncateCharacters} from '../utils/characters';import {useLocale} from '../i18n/useLocale';import type {Locale} from '../i18n/types';+import type {SearchableItem} from '../Typeahead/types';import type {PowerSearchConfig,PowerSearchFilter,@@ -739,22 +740,38 @@ export function PowerSearch({value: undefined,},});- } else if (change.type === 'remove' && change.item) {- const auxData = change.item.auxiliaryData as PowerSearchAuxData;- if (auxData?.filterIndex != null) {- const newFilters = filters.filter((_, i) =>- _items.some(item => item.auxiliaryData?.filterIndex === i),+ } else if (change.type === 'remove') {+ const keptIndices = new Set(+ _items.map(item => item.auxiliaryData?.filterIndex),+ );+ const firstRemovedIndex = filters.findIndex(+ (_, i) => !keptIndices.has(i),+ );+ if (firstRemovedIndex >= 0) {+ onChange(+ filters.filter((_, i) => keptIndices.has(i)),+ 'remove',+ firstRemovedIndex,);- onChange(newFilters, 'remove', auxData.filterIndex);}}},[config, filters, onChange, setPopoverState],);- // Tokenizer's Backspace does not go through renderToken. This predicate- // locks every token of a read-only field.- const isItemRemovable = useCallback(() => !isReadOnly, [isReadOnly]);+ // Tokenizer's Backspace and Clear all do not go through renderToken. This+ // predicate locks each read-only filter, and every token of a read-only+ // field.+ const isItemRemovable = useCallback(+ (item: SearchableItem) => {+ if (isReadOnly) {+ return false;+ }+ const filterIndex = (item as PowerSearchItem).auxiliaryData?.filterIndex;+ return filterIndex == null || !filters[filterIndex]?.isReadOnly;+ },+ [filters, isReadOnly],+ );// Handle clicking a token to editconst handleTokenClick = useCallback(@@ -1077,9 +1094,13 @@ export function PowerSearch({const announce = useAnnounce();// PowerSearch words its Clear all as its record does; the field announces// these words instead of Tokenizer's (component:Tokenizer AR7).+ const hasReadOnlyFilter = filters.some(filter => filter.isReadOnly);const clearAllMessage = useMemo(- () => t('@astryx.powersearch.allFiltersRemoved'),- [t],+ () =>+ hasReadOnlyFilter+ ? t('@astryx.powersearch.editableFiltersRemoved')+ : t('@astryx.powersearch.allFiltersRemoved'),+ [hasReadOnlyFilter, t],);const announcedResultCountRef = useRef(resultCountText);useEffect(() => {diff --git a/packages/core/src/Tokenizer/Tokenizer.test.tsx b/packages/core/src/Tokenizer/Tokenizer.test.tsxindex 1e4a99f85b..74d35145d1 100644--- a/packages/core/src/Tokenizer/Tokenizer.test.tsx+++ b/packages/core/src/Tokenizer/Tokenizer.test.tsx@@ -2790,6 +2790,50 @@ describe('Tokenizer incremental results (spec:AST-092)', () => {});describe('Tokenizer locked tokens (internal removable context)', () => {+ it('Clear all keeps a locked token and reports the last removed one', () => {+ const onChange = vi.fn();+ render(+ <TokenizerItemRemovableContext value={item => item.id !== '1'}>+ <Tokenizer+ label="Members"+ searchSource={userSource}+ value={[users[0], users[1], users[2]]}+ onChange={onChange}+ hasClear+ />+ </TokenizerItemRemovableContext>,+ );+ expect(+ screen.queryByRole('button', {name: 'Remove Alice'}),+ ).not.toBeInTheDocument();+ expect(+ screen.getByRole('button', {name: 'Remove Bob'}),+ ).toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', {name: /clear/i}));+ expect(onChange).toHaveBeenCalledTimes(1);+ expect(onChange).toHaveBeenCalledWith([users[0]], {+ item: users[2],+ type: 'remove',+ });+ });++ it('has no Clear all when every token is locked', () => {+ render(+ <TokenizerItemRemovableContext value={() => false}>+ <Tokenizer+ label="Members"+ searchSource={userSource}+ value={[users[0]]}+ onChange={() => {}}+ hasClear+ />+ </TokenizerItemRemovableContext>,+ );+ expect(+ screen.queryByRole('button', {name: /clear/i}),+ ).not.toBeInTheDocument();+ });+it('Backspace on an empty input removes nothing while the last token is locked', async () => {const user = userEvent.setup();const onChange = vi.fn();diff --git a/packages/core/src/Tokenizer/Tokenizer.tsx b/packages/core/src/Tokenizer/Tokenizer.tsxindex 28605174ea..b1337692dc 100644--- a/packages/core/src/Tokenizer/Tokenizer.tsx+++ b/packages/core/src/Tokenizer/Tokenizer.tsx@@ -1009,9 +1009,8 @@ export function Tokenizer<T extends SearchableItem>({// `endContent`, a clear button, or all three — so its width is measured// rather than assumed, and the input reserves it.const [laneRef, laneReserve] = useEndLaneReserve(END_LANE_INSET);- // A composing component can lock tokens (PowerSearch's read-only field).- // Backspace and the token remove controls skip a locked token. Clear all- // does not check it.+ // A composing component can lock tokens (PowerSearch's read-only filters+ // and read-only field). No remove path removes a locked token.const isItemRemovable = use(TokenizerItemRemovableContext);const canRemoveItem = useCallback((item: T) => isItemRemovable?.(item) ?? true,@@ -1021,7 +1020,7 @@ export function Tokenizer<T extends SearchableItem>({// is the leaf's own business — folding it in here would mean reading the// busy state during this render, which is exactly the re-render the store// exists to avoid.- const hasClearButton = hasClear && value.length > 0 && !isDisabled;+ const hasClearButton = hasClear && !isDisabled && value.some(canRemoveItem);const hasStaticEndLane = Boolean(endContent || hasClearButton);const [isFocusedWithin, setIsFocusedWithin] = useState(false);const isTruncated =@@ -1287,19 +1286,22 @@ export function Tokenizer<T extends SearchableItem>({[value, onChange, isDisabled, canRemoveItem, announce, t],);- // Handle clearing all items// A composing component that words its own Clear all (PowerSearch) provides// its words; otherwise the field's own (component:Tokenizer AR7).const clearAllMessage =use(TokenizerClearAllMessageContext) ?? t('@astryx.tokenizer.allRemoved');const handleClearAll = useCallback((options?: {silent?: boolean}) => {- if (isDisabled || value.length === 0) {+ const removedItems = value.filter(canRemoveItem);+ if (isDisabled || removedItems.length === 0) {return;}- // Report the last item as removed (convention)- const lastItem = value[value.length - 1];- onChange([], {item: lastItem, type: 'remove'});+ // onChange names one item. Clear all names the last one it removes.+ const lastRemovedItem = removedItems[removedItems.length - 1];+ onChange(+ value.filter(item => !canRemoveItem(item)),+ {item: lastRemovedItem, type: 'remove'},+ );// Focus moves to the input, so the emptied selection is announced, in// the sheet's words (WCAG 4.1.3). The sheet announces its own Clear all.if (!options?.silent) {@@ -1307,7 +1309,7 @@ export function Tokenizer<T extends SearchableItem>({}inputRef.current?.focus();},- [value, onChange, isDisabled, announce, clearAllMessage],+ [value, onChange, isDisabled, canRemoveItem, announce, clearAllMessage],);// Handle backspace on empty input — remove last token@@ -1370,7 +1372,7 @@ export function Tokenizer<T extends SearchableItem>({key={item.id}label={item.label}size={size}- onRemove={isDisabled ? undefined : onRemoveItem}+ onRemove={isDisabled || !canRemoveItem(item) ? undefined : onRemoveItem}isDisabled={isDisabled}xstyle={styles.token}/>diff --git a/packages/core/src/Tokenizer/TokenizerItemRemovableContext.ts b/packages/core/src/Tokenizer/TokenizerItemRemovableContext.tsindex e9b08cde36..2e3ee9e3e1 100644--- a/packages/core/src/Tokenizer/TokenizerItemRemovableContext.ts+++ b/packages/core/src/Tokenizer/TokenizerItemRemovableContext.ts@@ -8,9 +8,11 @@* @output A context carrying a predicate that tells which tokens the user can* remove* @position Internal to Core: not exported from the Tokenizer barrel. A- * component that composes Tokenizer and locks some tokens (PowerSearch: every- * filter of a read-only field) provides it. Backspace then removes nothing- * while the last token is locked. Without it, every token is removable.+ * component that composes Tokenizer and locks some tokens (PowerSearch: its+ * read-only filters, and every filter of a read-only field) provides it. In+ * the popover presentation, Clear all then keeps a locked token, Backspace+ * removes nothing while the last token is locked, and Clear all shows only+ * while a removable token remains. Without it, every token is removable.*/import {createContext} from 'react';