From 5067361dc000cb3ab2b0a180b6a4eae19cd7e7a2 Mon Sep 17 00:00:00 2001 From: Andrew Hayward Date: Thu, 7 Dec 2023 12:42:36 +0000 Subject: [PATCH] Adding `aria-sort` to table view headers (#56860) Ensures sorting semantics are not just communicated visually --- packages/dataviews/src/view-table.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/dataviews/src/view-table.js b/packages/dataviews/src/view-table.js index dece8a55107c03..0e51bd85cdee48 100644 --- a/packages/dataviews/src/view-table.js +++ b/packages/dataviews/src/view-table.js @@ -545,6 +545,9 @@ function ViewTable( { // TODO:Add spinner or progress bar.. return

{ __( 'Loading' ) }

; } + + const sortValues = { asc: 'ascending', desc: 'descending' }; + return (
{ hasRows && ( @@ -568,6 +571,11 @@ function ViewTable( { .maxWidth || undefined, } } data-field-id={ header.id } + aria-sort={ + sortValues[ + header.column.getIsSorted() + ] + } >