Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(PowerSearch): the docs examples fit a phone, and a long sheet-trigger placeholder ends in an ellipsis (#9898)

Xinzi Zhou380defeb5626
diff --git a/.changeset/powersearch-blocks-fit-phone.md b/.changeset/powersearch-blocks-fit-phone.md
new file mode 100644
index 0000000000..cd5a5019e4
--- /dev/null
+++ b/.changeset/powersearch-blocks-fit-phone.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[chore] The PowerSearch blocks fit a phone-sized screen. Each sizes its field through a grid column, `minmax(0, <width>)`: the old width where there is room, and the container's width where there is not. The Search with Table block's table scrolls inside its own frame on a narrow screen instead of widening the example.
+
+@imdreamrunner
diff --git a/.changeset/powersearch-sheet-trigger-long-placeholder.md b/.changeset/powersearch-sheet-trigger-long-placeholder.md
new file mode 100644
index 0000000000..91de2b2875
--- /dev/null
+++ b/.changeset/powersearch-sheet-trigger-long-placeholder.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] PowerSearch: in the sheet presentation, a placeholder longer than the trigger stays on one line and ends in an ellipsis. Before, it ran under the result count and, on a narrow field, past the field's border.
+
+@imdreamrunner
diff --git a/apps/storybook/stories/PowerSearch.stories.tsx b/apps/storybook/stories/PowerSearch.stories.tsx
index b8d5059e1e..ac9e2d6687 100644
--- a/apps/storybook/stories/PowerSearch.stories.tsx
+++ b/apps/storybook/stories/PowerSearch.stories.tsx
@@ -2190,6 +2190,32 @@ export const SheetPresentationContentSearch: Story = {
parameters: {viewport: {defaultViewport: 'mobile2'}},
};
+/**
+ * A placeholder longer than the trigger ends in an ellipsis inside it and
+ * stays clear of the result count at every width. The grid column sizes the
+ * field, so a test can narrow it.
+ */
+export const SheetPresentationLongPlaceholder: Story = {
+ render: () => {
+ const [filters, setFilters] = useState<ReadonlyArray<PowerSearchFilter>>(
+ [],
+ );
+ return (
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 360px)'}}>
+ <PowerSearch
+ config={fullConfig}
+ filters={filters}
+ onChange={next => setFilters(next)}
+ placeholder="Filter issues by title, assignee, status, label or date..."
+ resultCount={128}
+ presentation="bottom-sheet"
+ />
+ </div>
+ );
+ },
+ name: 'Bottom sheet with a long placeholder',
+};
+
/**
* Read-only keeps the Filters sheet as plain rows with Done only; disabled
* keeps the trigger focusable (aria-disabled) and shows its reason; the result
diff --git a/docs/specs/components/PowerSearch/PowerSearch.spec.md b/docs/specs/components/PowerSearch/PowerSearch.spec.md
index bf11b0307b..99fb9086c2 100644
--- a/docs/specs/components/PowerSearch/PowerSearch.spec.md
+++ b/docs/specs/components/PowerSearch/PowerSearch.spec.md
@@ -19,6 +19,7 @@ verified_by:
packages/core/src/PowerSearch/formatFilterValue.test.ts,
packages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx,
packages/core/src/PowerSearch/PowerSearch.ssr.test.tsx,
+ packages/core/src/PowerSearch/__tests__/PowerSearchSheetTrigger.a11y.chromium.spec.ts,
packages/core/src/Tokenizer/Tokenizer.test.tsx,
packages/core/src/Typeahead/Typeahead.test.tsx,
packages/core/src/Layer/useLayer.test.tsx,
@@ -254,7 +255,7 @@ FR10–FR21 govern. FR25 governs a date-only value in both, and FR26 a date-and-
| FR8 | In the `popover` presentation, the width and alignment change MUST NOT alter editor content, field/operator/value state, vertical placement, focus movement, selection, dismissal, or screen-reader semantics. | Compatibility and accessibility requirement | Accepted contract; implementation pending |
| 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 | `presentation` selects the surface. `adaptive`, the value when `presentation` is omitted, 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`); with a fine pointer or on a screen that is not compact it renders exactly the `popover` presentation. `popover` is the tokenizer field with its typeahead and editor popover on every device, unchanged except as FR19 (no mount announcement) states. `bottom-sheet` is the trigger and sheet flow of FR11–FR21 on every device. 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 | Current contract; verified by focused sheet tests and real-engine touch evidence. |
-| 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 and the same words for a value, and a `date_absolute` value reads as the sheet's date editor shows it (FR17): a date-only value as its day in `timezoneID`, else the UTC day, and a value whose operator sets `isDateOnly: false` as its date and time in `timezoneID`, else the viewer's zone. 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, every open sheet of the flow closes and focus moves to the trigger, the destination this record names (`spec:AST-085/FR4`). | DEC-3; touch-flow evidence; `spec:AST-085`; WCAG 2.5.3 | Current contract; verified by focused sheet tests and real-engine touch evidence. |
+| 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. A placeholder longer than the trigger stays on one line and ends in an ellipsis inside the trigger: it never runs under the result count or past the field's border. The trigger's tokens are the popover presentation's tokens, the same component and the same words for a value, and a `date_absolute` value reads as the sheet's date editor shows it (FR17): a date-only value as its day in `timezoneID`, else the UTC day, and a value whose operator sets `isDateOnly: false` as its date and time in `timezoneID`, else the viewer's zone. 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, every open sheet of the flow closes and focus moves to the trigger, the destination this record names (`spec:AST-085/FR4`). | DEC-3; touch-flow evidence; `spec:AST-085`; WCAG 2.5.3 | Current contract; verified by focused sheet tests and real-engine touch evidence. |
| 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". Its header — a heading and, while the field is interactive and at least one filter exists, an Add filter button at the medium size whose hit area is at least 44 px tall — and its footer — Done, which applies the sheet's draft (FR15b), and, while `hasClear` is set, the field is interactive, and at least one editable filter exists, Clear all — stay fixed while only the rows between them scroll, the scroll viewport reaching the sheet's edge so its scrollbar does too, with the rows' text on the header's inset. One row per filter shows "{field label} {operator label}" (one catalog message, so a locale can reorder it) and, in bold, the value as the trigger's token shows it — the same formatter, so the same words, with the token's width budget lifted: the row never truncates a single value and never collapses a list to its "{n} items" count — with the token's summaries resolved from the catalog (`@astryx.powersearch.valueEditor.dateRange`, `itemsCount`, `filtersCount`, ICU plurals): 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; 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 date-only `date_absolute` value reads as its day in `timezoneID`, else the UTC day, with no time, and one whose operator sets `isDateOnly: false` as its date and time in `timezoneID`, else the viewer's zone, 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. 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. A filter the field can edit is a row button that opens the value step on it, with a trailing remove action — an icon button at the medium size named "Remove {field label} filter", its hit area at least 44 px square, that removes it from the draft (FR15b) without opening the step — except that a filter whose operator takes an `empty` value (a one-tap boolean filter) is a row whose tap removes it, with the same trailing remove action, since it has no value to edit; a read-only filter, or every filter while the field is read-only, is a plain row with no remove action, 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 (FR14), its trailing remove action still the removal path; it is a plain row while the filter, or the field, is read-only. With no filter in the draft the body is one empty state: a heading — "No filters applied" while the field has none, "No filters" while the draft is empty but the field's filters are still applied (Done replaces them) — a line of guidance, and, while the field is interactive, a centered primary Add filter action that is then the sheet's only Add filter (the header shows none), so the single thing to do is the only visible action; the footer stays, with Done alone, while the draft differs from the applied filters (an emptied draft still has removals to apply), and is absent otherwise. Done closes the flow. Clear all opens a confirmation above the sheet — a dialog titled "Clear all filters?" with "Clear filters" and "Keep filters" — and only confirming removes the editable filters from the draft, recorded as `('remove', <index of the first removed filter>)` with `kept`, the read-only filters in their order, as the list (FR15b): read-only filters are the consumer's, not the person's, so Clear all leaves them in place, as the popover presentation's Clear all does (FR23); the Filters sheet stays open for further editing and focus returns to it (FR16). After the flow closes focus returns to the trigger. | DEC-3; touch-flow evidence; the read-only filter contract (`isReadOnly`, FR22); DEC-4 | Current contract; verified by focused sheet tests and real-engine touch evidence. |
| FR13 | Add filter — from the Filters sheet's Add filter action, or directly when an interactive field with no filter opens — is a tall modal sheet named "Add filter" opened above the Filters sheet, which stays open beneath it (FR15a), so the sheet has no Back action: dismissing it — Escape, a scrim tap, a swipe — reveals Filters again, or closes the flow when Add filter was the entry point, in which case its fixed footer holds Done. Its header — the heading and, when one shows, the search field — stays fixed while the rows scroll. Without a content-search field it lists the visible fields grouped by `group`, each group a named list: the ungrouped fields first, under the heading "General", then each group under its name in order of first appearance, each a row button with the field's icon, a trailing chevron — or, for a field whose only operator takes an `empty` value, a trailing plus, since choosing it adds the filter at once (FR15) — 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 the empty state "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`, 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 the empty state "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. Each of the two is a compact empty state with a search icon, that title, and the description "Try a different search.", mounted only while the Add filter sheet is the open one. Neither search field takes focus when the sheet opens: the sheet opens with focus on its panel and the software keyboard stays down until the person taps the search; a direct vertical touch drag on the rows while a search field has focus blurs it, so the keyboard leaves and the rows can be read. A suggestion that carries a value adds the filter to the draft (FR15b), recorded as `('add', draft.length)`, announces `Added {label}` inside the Filters sheet (AR6), and shows Filters as FR15a states; any other suggestion or field row opens the value step with that field and operator, above Add filter. Every visible field lists, a field whose every operator is `nested` included: the value step edits every operator's value (FR14). | DEC-3; touch-flow evidence; current typeahead source | Current contract; verified by focused sheet tests and real-engine touch evidence. |
| FR14 | The value step is a tall modal sheet that edits every operator's value, opened above the sheet that led to it — Filters for an edit, Add filter for a creation — which stays open beneath it (FR15a); 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. Its header and footer stay fixed while the body scrolls. 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 nested editor renders its controls in their `popover` presentations; 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 body's sections sit on the sheet's surface when the editor is the body's only section; when the body has more than one section — the Operator group above the editor — each section is a muted container, so the grouping reads without a frame around a lone editor. 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; the step has no Remove action: a filter is removed from its Filters row (FR12). 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`, `timezoneID` (FR25), `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 while the step is the open one (AR6), and keeps Cancel as the way out, the filter's trailing remove action on its Filters row being the removal path (FR12); when focus was on a control of the replaced body it moves to Cancel, so it never falls to the page body inside the open sheet (FR16). | DEC-3; touch-flow evidence | Current contract; verified by focused sheet tests and real-engine touch evidence. |
@@ -542,7 +543,7 @@ mark implementation and focused real-Chromium verification as pending.
| FR24 | `PowerSearchTokenNaming.test.tsx`; real-Chromium accessibility tree of a popover token | Popover token with a value, read-only token, editor open and closed, a verb-last remove word | A token named without its value, a missing or stale `aria-expanded`, an unnamed or non-dialog editor, or a remove name that loses its locale's word order fails. | `audit:PowerSearch/accessibility` |
| FR25 | PowerSearch date-zone tests under four host zones (UTC, Los Angeles, Tokyo, Honolulu) with `timezoneID` set to each zone and unset: token text, the removal announcement that carries the accessible label, the editor's opening day, the stored instant after a pick, a round trip that moves the day and back, a `components` Editor override and `PowerSearchFilterEditor` receiving the zone, range parts read and written, and an `isDateOnly: false` value left to FR26; plus the formatter's unit tests | a Los Angeles evening instant with `timezoneID` set and unset, a pick across the US daylight-time change, a `date_range` of two instants | The token and the editor show different days for one value, a re-picked day moves the instant, or a day shows a time | `audit:PowerSearch/interaction` |
| FR26 | PowerSearch date-and-time tests under four host zones (UTC, Los Angeles, Tokyo, Honolulu) with `timezoneID` set and unset: the token's date and time, the editor's opening date and time, the stored instant after a time is typed, a `components` Editor override and `PowerSearchFilterEditor` receiving the zone, the editor on a line of its own, and a date-only operator kept on the date picker; plus the sheet's value step opening on the time in `timezoneID` | a Los Angeles evening instant with `isDateOnly: false` and `timezoneID` Los Angeles, Tokyo, empty and unset; the same instant with `isDateOnly: true` | The token shows no time, the editor has no time field or opens on another time than the token shows, a typed time stores a different instant than it names, or a date-only operator gains a time field | `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 | the default resolving both ways, `popover` kept on a compact coarse-pointer screen, forced sheet, adaptive both ways (the default's server markup the same as `popover`'s, 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 sharing one formatter, a date-only value as its day in `timezoneID`, else the UTC day, and a date-and-time value in `timezoneID`, else the viewer's zone, on all three (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's remove action, 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 Cancel and announcing the unavailable state in the sheet while the step is open and never from a step beneath another or retained closed, Apply and Cancel after a controlled update removed the edited filter focusing the nearest row, else Add filter, a row's trailing remove action focusing the next row's remove action, a one-tap `empty`-valued filter added from its field row and removed from its row, Clear all behind its confirmation keeping read-only filters and leaving Filters open, a dismissed step revealing the step beneath with focus restored to it, Add filter opening with its search unfocused and a touch drag on the rows blurring a focused search, 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 mirrored in RTL (`design:bidirectionality/DR4`) | A field with a fine pointer or on a screen that is not compact changes by default beyond what FR19 states, `presentation="popover"` presents the sheet flow, a value commits before the step confirms, Clear all removes 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` |
+| FR10–FR21, AR4–AR6, PR5 | Focused PowerSearch sheet tests with the compact-touch query stubbed both ways, plus real-engine touch evidence and a real-engine width sweep of a long placeholder in both writing directions | the default resolving both ways, `popover` kept on a compact coarse-pointer screen, forced sheet, adaptive both ways (the default's server markup the same as `popover`'s, 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 sharing one formatter, a date-only value as its day in `timezoneID`, else the UTC day, and a date-and-time value in `timezoneID`, else the viewer's zone, on all three (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's remove action, 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 Cancel and announcing the unavailable state in the sheet while the step is open and never from a step beneath another or retained closed, Apply and Cancel after a controlled update removed the edited filter focusing the nearest row, else Add filter, a row's trailing remove action focusing the next row's remove action, a one-tap `empty`-valued filter added from its field row and removed from its row, Clear all behind its confirmation keeping read-only filters and leaving Filters open, a dismissed step revealing the step beneath with focus restored to it, Add filter opening with its search unfocused and a touch drag on the rows blurring a focused search, 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 mirrored in RTL (`design:bidirectionality/DR4`) | A field with a fine pointer or on a screen that is not compact changes by default beyond what FR19 states, `presentation="popover"` presents the sheet flow, a value commits before the step confirms, Clear all removes 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
diff --git a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx
index e4bed06a54..dc9db019f9 100644
--- a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx
+++ b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx
@@ -66,12 +66,13 @@ export default function PowerSearchContentSearch() {
const [filters, setFilters] = useState<PowerSearchFilter[]>([]);
return (
- <PowerSearch
- style={{width: 300}}
- config={config}
- filters={filters}
- onChange={newFilters => setFilters([...newFilters])}
- placeholder="Type to search by title, or pick a field..."
- />
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 300px)'}}>
+ <PowerSearch
+ config={config}
+ filters={filters}
+ onChange={newFilters => setFilters([...newFilters])}
+ placeholder="Type to search by title, or pick a field..."
+ />
+ </div>
);
}
diff --git a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx
index c30eb2464b..0a38d1b503 100644
--- a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx
+++ b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx
@@ -94,12 +94,13 @@ export default function PowerSearchFullFeatured() {
const [filters, setFilters] = useState<PowerSearchFilter[]>([]);
return (
- <PowerSearch
- style={{width: 300}}
- config={config}
- filters={filters}
- onChange={newFilters => setFilters([...newFilters])}
- placeholder="Search..."
- />
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 300px)'}}>
+ <PowerSearch
+ config={config}
+ filters={filters}
+ onChange={newFilters => setFilters([...newFilters])}
+ placeholder="Search..."
+ />
+ </div>
);
}
diff --git a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx
index c8229542ee..4896b800ba 100644
--- a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx
+++ b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx
@@ -69,12 +69,13 @@ export default function PowerSearchPresetFilters() {
]);
return (
- <PowerSearch
- style={{width: 360}}
- config={config}
- filters={filters}
- onChange={newFilters => setFilters([...newFilters])}
- placeholder="Add more filters..."
- />
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 360px)'}}>
+ <PowerSearch
+ config={config}
+ filters={filters}
+ onChange={newFilters => setFilters([...newFilters])}
+ placeholder="Add more filters..."
+ />
+ </div>
);
}
diff --git a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx
index 2e87651f92..e302a7b1b8 100644
--- a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx
+++ b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx
@@ -92,15 +92,17 @@ export default function PowerSearchSearchWithTable() {
const filteredBooks = applyFilters(filters, books);
return (
- <VStack gap={4} width="100%" style={{maxWidth: 500}}>
- <PowerSearch
- config={config}
- filters={filters}
- onChange={newFilters => setFilters([...newFilters])}
- placeholder="Filter books by title, author, year, genre..."
- resultCount={filteredBooks.length}
- />
- <Table data={filteredBooks} columns={columns} idKey="id" hasHover />
- </VStack>
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 500px)'}}>
+ <VStack gap={4}>
+ <PowerSearch
+ config={config}
+ filters={filters}
+ onChange={newFilters => setFilters([...newFilters])}
+ placeholder="Filter books by title, author, year, genre..."
+ resultCount={filteredBooks.length}
+ />
+ <Table data={filteredBooks} columns={columns} idKey="id" hasHover />
+ </VStack>
+ </div>
);
}
diff --git a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx
index 4ed8c59d94..7737940cca 100644
--- a/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx
+++ b/packages/cli/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx
@@ -55,12 +55,13 @@ export default function PowerSearchShowcase() {
const [filters, setFilters] = useState<PowerSearchFilter[]>(initialFilters);
return (
- <PowerSearch
- style={{width: 400}}
- config={config}
- filters={filters}
- onChange={newFilters => setFilters([...newFilters])}
- placeholder="Search by status, title..."
- />
+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>
+ <PowerSearch
+ config={config}
+ filters={filters}
+ onChange={newFilters => setFilters([...newFilters])}
+ placeholder="Search by status, title..."
+ />
+ </div>
);
}
diff --git a/packages/core/src/PowerSearch/PowerSearch.tsx b/packages/core/src/PowerSearch/PowerSearch.tsx
index 0378272bf3..137a8ef2fb 100644
--- a/packages/core/src/PowerSearch/PowerSearch.tsx
+++ b/packages/core/src/PowerSearch/PowerSearch.tsx
@@ -242,6 +242,15 @@ const sheetTriggerStyles = stylex.create({
},
outline: 'none',
},
+ // A placeholder longer than the trigger ends in an ellipsis inside it, as
+ // Selector's value does. It never runs under the result count or past the
+ // field's border.
+ placeholder: {
+ minWidth: 0,
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
// Once a token is present the empty trigger covers the token lane instead
// of reserving 40px or wrapping onto an otherwise blank row.
triggerWithTokens: {
@@ -1544,7 +1553,11 @@ export function PowerSearch({
sheetTriggerStyles.trigger,
filters.length > 0 && sheetTriggerStyles.triggerWithTokens,
)}>
- {filters.length === 0 ? placeholder : null}
+ {filters.length === 0 ? (
+ <span {...stylex.props(sheetTriggerStyles.placeholder)}>
+ {placeholder}
+ </span>
+ ) : null}
</button>
</div>
{(endContent || isRenderable(resultCountText)) && (
diff --git a/packages/core/src/PowerSearch/__tests__/PowerSearchSheetTrigger.a11y.chromium.spec.ts b/packages/core/src/PowerSearch/__tests__/PowerSearchSheetTrigger.a11y.chromium.spec.ts
new file mode 100644
index 0000000000..2863debcc4
--- /dev/null
+++ b/packages/core/src/PowerSearch/__tests__/PowerSearchSheetTrigger.a11y.chromium.spec.ts
@@ -0,0 +1,170 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+// @pr-a11y scope core/PowerSearch ^apps/storybook/stories/PowerSearch
+
+/**
+ * @file PowerSearchSheetTrigger.a11y.chromium.spec.ts
+ * @input The `Core/PowerSearch` long-placeholder sheet story in a built
+ * Storybook.
+ * @output Real-engine proof that the sheet trigger's placeholder stays inside
+ * the trigger, clear of the result count, and inside the field's border,
+ * across field widths and both writing directions.
+ * @position Run with `pnpm test:a11y-contract`. Whether text runs past its
+ * box depends on the width it gets, which only a shipping layout engine can
+ * show.
+ */
+
+import {expect, test, type Page} from '@astryxdesign/a11y-spec/playwright';
+import {
+ DEFAULT_STORYBOOK_DIR,
+ serveStorybook,
+ type StaticServer,
+} from '@astryxdesign/a11y-spec/storybook';
+
+let storybook: StaticServer;
+
+test.beforeAll(async () => {
+ storybook = await serveStorybook(
+ process.env.ASTRYX_STORYBOOK_DIR ?? DEFAULT_STORYBOOK_DIR,
+ );
+});
+
+test.afterAll(async () => {
+ await storybook?.close();
+});
+
+type Direction = 'ltr' | 'rtl';
+
+const STORY = 'core-powersearch--sheet-presentation-long-placeholder';
+
+async function open(page: Page, direction: Direction): Promise<void> {
+ await page.goto(
+ `${storybook.origin}/iframe.html?id=${STORY}&viewMode=story&globals=direction:${direction}`,
+ {waitUntil: 'load'},
+ );
+ await page
+ .locator('button[aria-haspopup="dialog"]')
+ .first()
+ .waitFor({state: 'visible'});
+ await page.evaluate(async () => {
+ await document.fonts.ready;
+ });
+}
+
+/**
+ * Sizes the story's grid column to `width` and returns every way the
+ * placeholder's painted text escapes its place: past the trigger button, into
+ * the result count, or past the field's border, plus a field whose content is
+ * wider than its box. The painted text is the text's own box, cut to the
+ * nearest element inside the trigger that clips it.
+ */
+async function escapesAt(page: Page, width: number): Promise<string[]> {
+ return page.evaluate(async width => {
+ const host = document.querySelector<HTMLElement>(
+ '#storybook-root [style*="grid-template-columns"]',
+ );
+ if (host == null) {
+ throw new Error('No sizing grid in the story');
+ }
+ host.style.gridTemplateColumns = `minmax(0, ${width}px)`;
+ for (let frame = 0; frame < 4; frame++) {
+ await new Promise(resolve => requestAnimationFrame(resolve));
+ }
+ const trigger = host.querySelector('button[aria-haspopup="dialog"]');
+ const field = host.querySelector('.astryx-power-search');
+ const count = [...host.querySelectorAll('span')].find(
+ span => span.textContent === '128 results',
+ );
+ if (trigger == null || field == null) {
+ throw new Error('The story has no sheet trigger');
+ }
+ const walker = document.createTreeWalker(trigger, NodeFilter.SHOW_TEXT);
+ let text: Node | null = walker.nextNode();
+ while (text != null && (text.textContent ?? '').trim() === '') {
+ text = walker.nextNode();
+ }
+ if (text == null) {
+ throw new Error('The trigger shows no placeholder');
+ }
+ const range = document.createRange();
+ range.selectNodeContents(text);
+ const r = range.getBoundingClientRect();
+ let left = r.left;
+ let right = r.right;
+ for (
+ let el = text.parentElement;
+ el != null && el !== trigger.parentElement;
+ el = el.parentElement
+ ) {
+ if (['hidden', 'clip'].includes(getComputedStyle(el).overflowX)) {
+ const c = el.getBoundingClientRect();
+ left = Math.max(left, c.left);
+ right = Math.min(right, c.right);
+ }
+ }
+ const found: string[] = [];
+ const t = trigger.getBoundingClientRect();
+ const f = field.getBoundingClientRect();
+ if (left < t.left - 0.5 || right > t.right + 0.5) {
+ found.push(`${width}px: the placeholder runs past the trigger`);
+ }
+ if (left < f.left - 0.5 || right > f.right + 0.5) {
+ found.push(`${width}px: the placeholder runs past the field`);
+ }
+ if (count != null) {
+ const c = count.getBoundingClientRect();
+ if (right > c.left + 0.5 && left < c.right - 0.5) {
+ found.push(`${width}px: the placeholder runs under the result count`);
+ }
+ }
+ if (field.scrollWidth > field.clientWidth + 1) {
+ found.push(
+ `${width}px: the field's content is ${field.scrollWidth}px in a ${field.clientWidth}px box`,
+ );
+ }
+ return found;
+ }, width);
+}
+
+for (const direction of ['ltr', 'rtl'] as const) {
+ test.describe(`${direction}`, () => {
+ test('a long placeholder stays inside the trigger and clear of the result count', async ({
+ page,
+ }) => {
+ await open(page, direction);
+ const found: string[] = [];
+ for (let width = 160; width <= 400; width += 20) {
+ found.push(...(await escapesAt(page, width)));
+ }
+ expect(found).toEqual([]);
+ });
+
+ test('a narrowed placeholder ends in an ellipsis', async ({page}) => {
+ await open(page, direction);
+ await escapesAt(page, 200);
+ // The element that holds the placeholder's text: it clips the text and
+ // draws the ellipsis.
+ const truncation = await page
+ .locator('button[aria-haspopup="dialog"]')
+ .first()
+ .evaluate(trigger => {
+ const walker = document.createTreeWalker(
+ trigger,
+ NodeFilter.SHOW_TEXT,
+ );
+ let text: Node | null = walker.nextNode();
+ while (text != null && (text.textContent ?? '').trim() === '') {
+ text = walker.nextNode();
+ }
+ const holder = text?.parentElement ?? trigger;
+ const style = getComputedStyle(holder);
+ return {
+ clipped:
+ holder.scrollWidth > holder.clientWidth &&
+ ['hidden', 'clip'].includes(style.overflowX),
+ textOverflow: style.textOverflow,
+ };
+ });
+ expect(truncation).toEqual({clipped: true, textOverflow: 'ellipsis'});
+ });
+ });
+}