Skip to content

Commit 71b9ab7

Browse files
authored
fix(table,a11y): only apply aria-sort when sorting for V6 (#11147)
* fix(table,a11y): only apply aria-sort when sorting * fix snapshots from cherrypick
1 parent c901a25 commit 71b9ab7

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default [
1616
'packages/react-core/src/helpers/Popper/thirdparty',
1717
'packages/react-docs/patternfly-docs/generated',
1818
'.history/*',
19-
'packages/react-docs/static'
19+
'packages/react-docs/static',
20+
'**/.cache'
2021
]
2122
},
2223
js.configs.recommended,

packages/react-table/src/components/Table/utils/decorators/sortable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const sortable: ITransform = (
5353

5454
return {
5555
className: css(styles.tableSort, isSortedBy && styles.modifiers.selected, className),
56-
'aria-sort': isSortedBy ? `${sortBy.direction}ending` : 'none',
56+
...(isSortedBy && { 'aria-sort': `${sortBy.direction}ending` }),
5757
children: (
5858
<SortColumn
5959
isSortedBy={isSortedBy}

packages/react-table/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ exports[`Table Actions table 1`] = `
2020
data-ouia-safe="true"
2121
>
2222
<th
23-
aria-sort="none"
2423
class="pf-v6-c-table__th pf-v6-c-table__sort"
2524
data-key="0"
2625
data-label="Header cell"
@@ -861,7 +860,6 @@ exports[`Table Cell header table 1`] = `
861860
data-ouia-safe="true"
862861
>
863862
<th
864-
aria-sort="none"
865863
class="pf-v6-c-table__th pf-v6-c-table__sort"
866864
data-key="0"
867865
data-label="Header cell"
@@ -1433,7 +1431,6 @@ exports[`Table Collapsible nested table 1`] = `
14331431
tabindex="-1"
14341432
/>
14351433
<th
1436-
aria-sort="none"
14371434
class="pf-v6-c-table__th pf-v6-c-table__sort"
14381435
data-key="1"
14391436
data-label="Header cell"
@@ -2198,7 +2195,6 @@ exports[`Table Collapsible table 1`] = `
21982195
tabindex="-1"
21992196
/>
22002197
<th
2201-
aria-sort="none"
22022198
class="pf-v6-c-table__th pf-v6-c-table__sort"
22032199
data-key="1"
22042200
data-label="Header cell"
@@ -4234,7 +4230,6 @@ exports[`Table Selectable table 1`] = `
42344230
</label>
42354231
</th>
42364232
<th
4237-
aria-sort="none"
42384233
class="pf-v6-c-table__th pf-v6-c-table__sort"
42394234
data-key="1"
42404235
data-label="Header cell"
@@ -4927,7 +4922,6 @@ exports[`Table Selectable table with Radio 1`] = `
49274922
tabindex="-1"
49284923
/>
49294924
<th
4930-
aria-sort="none"
49314925
class="pf-v6-c-table__th pf-v6-c-table__sort"
49324926
data-key="1"
49334927
data-label="Header cell"
@@ -5717,7 +5711,6 @@ exports[`Table Simple Actions table 1`] = `
57175711
data-ouia-safe="true"
57185712
>
57195713
<th
5720-
aria-sort="none"
57215714
class="pf-v6-c-table__th pf-v6-c-table__sort"
57225715
data-key="0"
57235716
data-label="Header cell"
@@ -6640,7 +6633,6 @@ exports[`Table Table variants Breakpoint - 1`] = `
66406633
data-ouia-safe="true"
66416634
>
66426635
<th
6643-
aria-sort="none"
66446636
class="pf-v6-c-table__th pf-v6-c-table__sort"
66456637
data-key="0"
66466638
data-label="Header cell"
@@ -7169,7 +7161,6 @@ exports[`Table Table variants Breakpoint - grid 1`] = `
71697161
data-ouia-safe="true"
71707162
>
71717163
<th
7172-
aria-sort="none"
71737164
class="pf-v6-c-table__th pf-v6-c-table__sort"
71747165
data-key="0"
71757166
data-label="Header cell"
@@ -7698,7 +7689,6 @@ exports[`Table Table variants Breakpoint - grid-2xl 1`] = `
76987689
data-ouia-safe="true"
76997690
>
77007691
<th
7701-
aria-sort="none"
77027692
class="pf-v6-c-table__th pf-v6-c-table__sort"
77037693
data-key="0"
77047694
data-label="Header cell"
@@ -8227,7 +8217,6 @@ exports[`Table Table variants Breakpoint - grid-lg 1`] = `
82278217
data-ouia-safe="true"
82288218
>
82298219
<th
8230-
aria-sort="none"
82318220
class="pf-v6-c-table__th pf-v6-c-table__sort"
82328221
data-key="0"
82338222
data-label="Header cell"
@@ -8756,7 +8745,6 @@ exports[`Table Table variants Breakpoint - grid-md 1`] = `
87568745
data-ouia-safe="true"
87578746
>
87588747
<th
8759-
aria-sort="none"
87608748
class="pf-v6-c-table__th pf-v6-c-table__sort"
87618749
data-key="0"
87628750
data-label="Header cell"
@@ -9285,7 +9273,6 @@ exports[`Table Table variants Breakpoint - grid-xl 1`] = `
92859273
data-ouia-safe="true"
92869274
>
92879275
<th
9288-
aria-sort="none"
92899276
class="pf-v6-c-table__th pf-v6-c-table__sort"
92909277
data-key="0"
92919278
data-label="Header cell"
@@ -9814,7 +9801,6 @@ exports[`Table Table variants Size - compact 1`] = `
98149801
data-ouia-safe="true"
98159802
>
98169803
<th
9817-
aria-sort="none"
98189804
class="pf-v6-c-table__th pf-v6-c-table__sort"
98199805
data-key="0"
98209806
data-label="Header cell"
@@ -10908,7 +10894,6 @@ exports[`Table simple Row click table 1`] = `
1090810894
data-ouia-safe="true"
1090910895
>
1091010896
<th
10911-
aria-sort="none"
1091210897
class="pf-v6-c-table__th pf-v6-c-table__sort"
1091310898
data-key="0"
1091410899
data-label="Header cell"
@@ -11437,7 +11422,6 @@ exports[`Table simple Sortable table 1`] = `
1143711422
data-ouia-safe="true"
1143811423
>
1143911424
<th
11440-
aria-sort="none"
1144111425
class="pf-v6-c-table__th pf-v6-c-table__sort"
1144211426
data-key="0"
1144311427
data-label="Header cell"

0 commit comments

Comments
 (0)