Skip to content

Commit

Permalink
chore(Table): added more arialabeling for empty/nontext Table headers (
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye authored Mar 29, 2024
1 parent 83fb706 commit e9870d2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,23 @@ export const TableDraggable: React.FunctionComponent = () => {
</Tr>
</Thead>
<Tbody ref={bodyRef} onDragOver={onDragOver} onDrop={onDragOver} onDragLeave={onDragLeave}>
{rows.map((row, rowIndex) => (
<Tr key={rowIndex} id={row.id} draggable onDrop={onDrop} onDragEnd={onDragEnd} onDragStart={onDragStart}>
<Td
draggableRow={{
id: `draggable-row-${row.id}`
}}
/>
{Object.keys(row).map((key, keyIndex) => (
<Td key={`${rowIndex}_${keyIndex}`} dataLabel={columns[keyIndex]}>
{row[key]}
</Td>
))}
</Tr>
))}
{rows.map((row, rowIndex) => {
const rowCellsToBuild = Object.keys(row).filter((rowCell) => rowCell !== 'id');
return (
<Tr key={rowIndex} id={row.id} draggable onDrop={onDrop} onDragEnd={onDragEnd} onDragStart={onDragStart}>
<Td
draggableRow={{
id: `draggable-row-${row.id}`
}}
/>
{rowCellsToBuild.map((key, keyIndex) => (
<Td key={`${rowIndex}_${keyIndex}`} dataLabel={columns[keyIndex]}>
{row[key]}
</Td>
))}
</Tr>
);
})}
</Tbody>
</Table>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const TableSelectable: React.FunctionComponent = () => {
onSelect: (_event, isSelecting) => selectAllRepos(isSelecting),
isSelected: areAllReposSelected
}}
aria-label="Row select"
/>
<Th>{columnNames.name}</Th>
<Th>{columnNames.branches}</Th>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-table/src/demos/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

### Column management with draggable

```js isFullscreen file="./examples/TableColumnManagementWithDraggable.tsx"
```js isDeprecated isFullscreen file="./examples/TableColumnManagementWithDraggable.tsx"

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export const TableExpandCollapseAll: React.FunctionComponent = () => {
collapseAllAriaLabel,
onToggle: onCollapseAll
}}
></Th>
aria-label="Row expansion"
/>
{expandableColumns.map((column) => (
<Th key={column}>{column}</Th>
))}
Expand Down

0 comments on commit e9870d2

Please sign in to comment.