An open source design system that's fully customizable and agent ready
TypeScript
fix(a11y,rtl): unbreak the weekly a11y scan and Schedule's RTL chevrons (#5383)
Cindy Zhang6c8b15c0131f
diff --git a/.changeset/a11y-table-row-expansion-header.md b/.changeset/a11y-table-row-expansion-header.mdnew file mode 100644index 0000000000..4c95353214--- /dev/null+++ b/.changeset/a11y-table-row-expansion-header.md@@ -0,0 +1,6 @@+---+'@astryxdesign/core': patch+---++[fix] Table useTableRowExpansion: the chevron gutter's column header now carries a visually hidden localized name ("Row expansion", key `@astryx.tableRowExpansion.columnHeader`) instead of an empty `<th>` (axe empty-table-header, WCAG 1.3.1 best practice). The gutter stays visually blank.+@cixzhangdiff --git a/.github/a11y-baseline.json b/.github/a11y-baseline.jsonindex 0cf359b00b..ce113c8b0f 100644--- a/.github/a11y-baseline.json+++ b/.github/a11y-baseline.json@@ -918,6 +918,11 @@"impact": "serious","helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-conditional-attr?application=playwright"},+ {+ "key": "TableTree::Row Click Expansion::aria-conditional-attr",+ "impact": "serious",+ "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-conditional-attr?application=playwright"+ },{"key": "TableTree::With Selection::aria-conditional-attr","impact": "serious",@@ -977,26 +982,6 @@"key": "Tokenizer::Disabled::color-contrast","impact": "serious","helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright"- },- {- "key": "useContainerReveal::Inverted Conceal::color-contrast",- "impact": "serious",- "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright"- },- {- "key": "useContainerReveal::Nested Isolation::color-contrast",- "impact": "serious",- "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright"- },- {- "key": "useContainerReveal::Preserve Layout::color-contrast",- "impact": "serious",- "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright"- },- {- "key": "useContainerReveal::Reveal::color-contrast",- "impact": "serious",- "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright"}]}diff --git a/apps/storybook/stories/UseContainerReveal.stories.tsx b/apps/storybook/stories/UseContainerReveal.stories.tsxindex ec1d59d201..0af24aea2e 100644--- a/apps/storybook/stories/UseContainerReveal.stories.tsx+++ b/apps/storybook/stories/UseContainerReveal.stories.tsx@@ -6,6 +6,7 @@ import {useState} from 'react';import {useContainerReveal} from '@astryxdesign/core/hooks';import {Button} from '@astryxdesign/core/Button';import {mergeProps} from '@astryxdesign/core/utils';+import {colorVars} from '@astryxdesign/core/theme/tokens.stylex';import {TrashIcon, PencilIcon} from '@heroicons/react/24/outline';const styles = stylex.create({@@ -32,7 +33,11 @@ const styles = stylex.create({},label: {fontSize: 14},actions: {display: 'flex', gap: 4},- hint: {fontSize: 12, color: '#888', marginBottom: 8},+ hint: {+ fontSize: 12,+ color: colorVars['--color-text-secondary'],+ marginBottom: 8,+ },toggle: {marginBottom: 8},nested: {marginTop: 8,diff --git a/packages/core/locales/en.json b/packages/core/locales/en.jsonindex ca7bb42e69..e0c8bb5f47 100644--- a/packages/core/locales/en.json+++ b/packages/core/locales/en.json@@ -1071,6 +1071,10 @@"defaultMessage": "Expand row","description": "Screen-reader-only label on the row-expand chevron when the row is currently collapsed. Part of a four-way set with `collapseRow`, `expandAllRows`, `collapseAllRows`."},+ "@astryx.tableRowExpansion.columnHeader": {+ "defaultMessage": "Row expansion",+ "description": "Screen-reader-only header for the leading column that holds the per-row expand/collapse chevrons. The column shows no visible label."+ },"@astryx.tableRowExpansion.collapseAllRows": {"defaultMessage": "Collapse all rows","description": "Screen-reader-only label on the same header button when every row is expanded. Part of the four-way set."diff --git a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsxindex 462782466f..1b3ddbb6d5 100644--- a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx+++ b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx@@ -21,6 +21,7 @@ import {useMemo, useRef, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import {spacingVars, colorVars, radiusVars} from '../../../theme/tokens.stylex';import {Icon} from '../../../Icon';+import {VisuallyHidden} from '../../../VisuallyHidden';import {resolveContextActions} from '../../tableContextMenu';import {useTranslator} from '../../../i18n';import {rtlStyles} from '../../../utils';@@ -207,7 +208,13 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(const expansionColumn = useMemo((): TableColumn<T> => ({key: '__expansion',- header: '',+ // A `<th>` with no discernible text is announced as an unlabelled+ // column; the label is hidden because the column shows only chevrons.+ header: (+ <VisuallyHidden>+ {t('@astryx.tableRowExpansion.columnHeader')}+ </VisuallyHidden>+ ),width: EXPANSION_COLUMN_WIDTH,resizable: false,renderCell: (item: T) => {@@ -226,7 +233,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>();},}),- [expandedKeys, onToggle, getRowKey, getIsItemExpandable],+ [expandedKeys, onToggle, getRowKey, getIsItemExpandable, t],);return useMemo(diff --git a/packages/lab/src/Schedule/plugins/PaginationPlugin.tsx b/packages/lab/src/Schedule/plugins/PaginationPlugin.tsxindex f679c210c6..59738356fd 100644--- a/packages/lab/src/Schedule/plugins/PaginationPlugin.tsx+++ b/packages/lab/src/Schedule/plugins/PaginationPlugin.tsx@@ -14,6 +14,7 @@ import {Button} from '@astryxdesign/core/Button';import {ButtonGroup} from '@astryxdesign/core/ButtonGroup';import {Icon} from '@astryxdesign/core/Icon';import {IconButton} from '@astryxdesign/core/IconButton';+import {rtlStyles} from '@astryxdesign/core/utils';import {useScheduleContext} from '../context';import type {ScheduleHeaderContent,@@ -37,13 +38,27 @@ function SchedulePaginationControls() {<ButtonGroup label="Schedule pagination" size="sm"><IconButtonlabel={previousDateLabel}- icon={<Icon icon="chevronLeft" size="sm" color="inherit" />}+ icon={+ <Icon+ icon="chevronLeft"+ size="sm"+ color="inherit"+ xstyle={rtlStyles.mirror}+ />+ }onClick={onPreviousDate}/><Button label="Today" size="sm" onClick={onToday} /><IconButtonlabel={nextDateLabel}- icon={<Icon icon="chevronRight" size="sm" color="inherit" />}+ icon={+ <Icon+ icon="chevronRight"+ size="sm"+ color="inherit"+ xstyle={rtlStyles.mirror}+ />+ }onClick={onNextDate}/></ButtonGroup>@@ -85,14 +100,10 @@ function createSchedulePaginationPlugin({};}-export const defaultSchedulePaginationPlugin =- createSchedulePaginationPlugin();+export const defaultSchedulePaginationPlugin = createSchedulePaginationPlugin();export function useSchedulePaginationPlugin({position = 'start',}: SchedulePaginationPluginOptions = {}): SchedulePlugin {- return useMemo(- () => createSchedulePaginationPlugin({position}),- [position],- );+ return useMemo(() => createSchedulePaginationPlugin({position}), [position]);}diff --git a/packages/lab/src/Schedule/shared.tsx b/packages/lab/src/Schedule/shared.tsxindex df88908c00..be3fac11b1 100644--- a/packages/lab/src/Schedule/shared.tsx+++ b/packages/lab/src/Schedule/shared.tsx@@ -244,12 +244,13 @@ export function ListEventRow({const {categories} = useScheduleContext();const category = getEventCategory(event, categories);return (- <div {...stylex.props(styles.listEventRow, isPast && styles.listEventPast)}>+ <div {...stylex.props(styles.listEventRow)}><spanaria-hidden{...stylex.props(styles.listEventDot,eventDotColorStyle(category.color),+ isPast && styles.listEventDotPast,)}/><span {...stylex.props(styles.listEventTime)}>@@ -257,7 +258,13 @@ export function ListEventRow({? 'All day': formatEventTimeRange(event, timezoneID)}</span>- <span {...stylex.props(styles.listEventTitle)}>{event.title}</span>+ <span+ {...stylex.props(+ styles.listEventTitle,+ isPast && styles.listEventTitlePast,+ )}>+ {event.title}+ </span></div>);}@@ -1072,7 +1079,13 @@ export const styles = stylex.create({lineHeight: typeScaleVars['--text-body-leading'],fontWeight: fontWeightVars['--font-weight-medium'],},- listEventPast: {+ // A past row is muted with the secondary text token, which the theme+ // guarantees at AA. Fading the whole row with opacity instead pulled its+ // text toward the surface behind it — 2.35:1 on the light theme.+ listEventTitlePast: {+ color: colorVars['--color-text-secondary'],+ },+ listEventDotPast: {opacity: 0.5,},eventBlue: {