Skip to content

Commit

Permalink
fix(table,a11y): only apply aria-sort when sorting for V6 (#11147)
Browse files Browse the repository at this point in the history
* fix(table,a11y): only apply aria-sort when sorting

* fix snapshots from cherrypick
  • Loading branch information
kmcfaul authored Oct 30, 2024
1 parent c901a25 commit 71b9ab7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default [
'packages/react-core/src/helpers/Popper/thirdparty',
'packages/react-docs/patternfly-docs/generated',
'.history/*',
'packages/react-docs/static'
'packages/react-docs/static',
'**/.cache'
]
},
js.configs.recommended,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const sortable: ITransform = (

return {
className: css(styles.tableSort, isSortedBy && styles.modifiers.selected, className),
'aria-sort': isSortedBy ? `${sortBy.direction}ending` : 'none',
...(isSortedBy && { 'aria-sort': `${sortBy.direction}ending` }),
children: (
<SortColumn
isSortedBy={isSortedBy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`Table Actions table 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -861,7 +860,6 @@ exports[`Table Cell header table 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -1433,7 +1431,6 @@ exports[`Table Collapsible nested table 1`] = `
tabindex="-1"
/>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="1"
data-label="Header cell"
Expand Down Expand Up @@ -2198,7 +2195,6 @@ exports[`Table Collapsible table 1`] = `
tabindex="-1"
/>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="1"
data-label="Header cell"
Expand Down Expand Up @@ -4234,7 +4230,6 @@ exports[`Table Selectable table 1`] = `
</label>
</th>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="1"
data-label="Header cell"
Expand Down Expand Up @@ -4927,7 +4922,6 @@ exports[`Table Selectable table with Radio 1`] = `
tabindex="-1"
/>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="1"
data-label="Header cell"
Expand Down Expand Up @@ -5717,7 +5711,6 @@ exports[`Table Simple Actions table 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -6640,7 +6633,6 @@ exports[`Table Table variants Breakpoint - 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -7169,7 +7161,6 @@ exports[`Table Table variants Breakpoint - grid 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -7698,7 +7689,6 @@ exports[`Table Table variants Breakpoint - grid-2xl 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -8227,7 +8217,6 @@ exports[`Table Table variants Breakpoint - grid-lg 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -8756,7 +8745,6 @@ exports[`Table Table variants Breakpoint - grid-md 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -9285,7 +9273,6 @@ exports[`Table Table variants Breakpoint - grid-xl 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -9814,7 +9801,6 @@ exports[`Table Table variants Size - compact 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -10908,7 +10894,6 @@ exports[`Table simple Row click table 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down Expand Up @@ -11437,7 +11422,6 @@ exports[`Table simple Sortable table 1`] = `
data-ouia-safe="true"
>
<th
aria-sort="none"
class="pf-v6-c-table__th pf-v6-c-table__sort"
data-key="0"
data-label="Header cell"
Expand Down

0 comments on commit 71b9ab7

Please sign in to comment.