Repository navigation
Closed
Labels
Description
Description
In the default (popover) presentation, each filter token is a Token with onClick, so its action is the token's inner <button>. Two things are missing from that button:
- The value is not in its name. PowerSearch passes
"{field}: {operator}"as the tokenlabeland renders the value asendContent(PowerSearch.tsx:898-902). Token names its inner button from the label alone and putsendContentoutside the button (Token.tsx:458-470, Token AR2). So a token that shows "Status: is Open" is a button named "Status: is", and its remove button is "Remove Status: is". Two filters on one field with different values (or one filter whose value changed) sound the same. The visible text is not in the name either (WCAG 2.5.3 Label in Name). - Nothing says it opens an editor. Pressing the token opens the filter editor popover and moves focus into it (PowerSearchEditPopover.tsx:638), but the button has no
aria-expanded(oraria-haspopup), so it reads as a plain button that acts on press. Token gives a caller no way to set either: its inner button takes onlyonClick.
Expected: the token's action is named by everything the token shows (field, operator and value), and it exposes aria-expanded while its editor is open, as the sheet presentation's trigger already does (PowerSearch FR11). That likely needs Token to accept a name or ARIA props for its inner button, or PowerSearch to put the full text in the label.
Reproduction
import {useState} from 'react';
import {PowerSearch, type PowerSearchConfig, type PowerSearchFilter} from '@astryxdesign/core';
const config: PowerSearchConfig = {
name: 'Issues',
fields: [
{
key: 'status',
label: 'Status',
defaultOperator: 'is',
operators: [
{
key: 'is',
label: 'is',
value: {type: 'enum', values: [{value: 'open', label: 'Open'}, {value: 'closed', label: 'Closed'}]},
},
],
},
],
};
export function Repro() {
const [filters, setFilters] = useState<PowerSearchFilter[]>([
{field: 'status', operator: 'is', value: {type: 'enum', value: 'open'}},
]);
return <PowerSearch config={config} filters={filters} onChange={f => setFilters([...f])} />;
}- Inspect the accessibility tree: the token shows "Status: is Open", but its button is named "Status: is", and the remove button "Remove Status: is".
- Focus the token and press Enter. The editor opens and focus moves into it; the token's button has no
aria-expandedbefore or after.
Astryx Version
@astryxdesign/[email protected], still present on main (14fc587)
Environment
Chromium 156, accessibility tree read through the DevTools protocol. Not specific to one screen reader.
Activity
fix(PowerSearch): name a filter token by its visible text and expose …