Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Table): added more arialabeling for empty/nontext Table headers #10205

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This demo is importing the deprecated Table.


```

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
Loading