Skip to content

Commit b17dbee

Browse files
committed
fix: Fix Axe violation for heading one availability, and AriaLabel violations
1 parent 60eb090 commit b17dbee

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

pages/table/grouped-column-with-preference.page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,17 @@ export default function EC2TableDemo() {
270270
],
271271
});
272272

273+
const ariaLabels: TableProps<EC2Instance>['ariaLabels'] = {
274+
selectionGroupLabel: 'EC2 instances selection',
275+
allItemsSelectionLabel: ({ selectedItems }) =>
276+
`${selectedItems.length} ${selectedItems.length === 1 ? 'instance' : 'instances'} selected`,
277+
itemSelectionLabel: ({ selectedItems }, item) => {
278+
const isItemSelected = selectedItems.includes(item);
279+
return `${item.name} is ${isItemSelected ? '' : 'not '}selected`;
280+
},
281+
tableLabel: 'EC2 Instances',
282+
};
283+
273284
const { items, actions, filteredItemsCount, collectionProps, filterProps, paginationProps } = useCollection(
274285
allInstances,
275286
{
@@ -299,6 +310,7 @@ export default function EC2TableDemo() {
299310

300311
return (
301312
<SimplePage title="Grouped Column table demo with collection hooks" i18n={{}} screenshotArea={{}}>
313+
<h1>EC2 Instances Table</h1>
302314
<Table
303315
{...collectionProps}
304316
selectionType="multi"
@@ -308,6 +320,7 @@ export default function EC2TableDemo() {
308320
}}
309321
// variant="stacked"
310322
enableKeyboardNavigation={true}
323+
ariaLabels={ariaLabels}
311324
header={
312325
<Header
313326
counter={

0 commit comments

Comments
 (0)