Skip to content

Commit

Permalink
Replace sort 'buttons' with spans
Browse files Browse the repository at this point in the history
The interactive part of sorting is the entire heading, but by using the 'button' tag for the sort direction arrows indicates to screen readers that the arrows themselves are the interactive content. Not only is this bad practice, but the arrows we are using in Grid.js are below the minimum size requirements for WCAG standard 2.5.8 - 24x24 pixels. By changing the indicators from buttons to spans, we stick to the best practice and avoid the WCAG violation with miniscule changes to the code and no conflicts.
  • Loading branch information
TheWerbinator committed Oct 8, 2024
1 parent 9a6a53e commit 3e809cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/theme/mermaid/sort.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
button.gridjs {
span.gridjs {
&-sort {
float: right;
height: 24px;
Expand Down
2 changes: 1 addition & 1 deletion src/view/plugin/sort/sort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export function Sort(
};

return (
<button
<span
// because the corresponding <th> has tabIndex=0
tabIndex={-1}
aria-label={_(`sort.sort${direction === 1 ? 'Desc' : 'Asc'}`)}
Expand Down

0 comments on commit 3e809cf

Please sign in to comment.