Skip to content

Commit

Permalink
Adding aria-sort to table view headers (#56860)
Browse files Browse the repository at this point in the history
Ensures sorting semantics are not just communicated visually
  • Loading branch information
Andrew Hayward authored Dec 7, 2023
1 parent e63ef38 commit 5067361
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/dataviews/src/view-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ function ViewTable( {
// TODO:Add spinner or progress bar..
return <h3>{ __( 'Loading' ) }</h3>;
}

const sortValues = { asc: 'ascending', desc: 'descending' };

return (
<div className="dataviews-table-view-wrapper">
{ hasRows && (
Expand All @@ -568,6 +571,11 @@ function ViewTable( {
.maxWidth || undefined,
} }
data-field-id={ header.id }
aria-sort={
sortValues[
header.column.getIsSorted()
]
}
>
<HeaderMenu
dataView={ dataView }
Expand Down

1 comment on commit 5067361

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 5067361.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7128322042
📝 Reported issues:

Please sign in to comment.