Skip to content

Commit

Permalink
fix(datagrid): screen reader misreads datagrid table headers (#5716)
Browse files Browse the repository at this point in the history
* fix(datagrid): screen reader misreads datagrid table headers

* fix(datagrid): screen reader reading header ahead by 1, mozilla

* fix: snapshot

* fix: datagrid tests
  • Loading branch information
devadula-nandan authored Jul 30, 2024
1 parent d05c2da commit 137f5b1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3710,6 +3710,7 @@ p.c4p--about-modal__copyright-text:first-child {
}
.c4p--datagrid__head-hidden-select-all {
min-width: 3rem;
padding-right: 3rem;
}
.c4p--datagrid__head-hidden-select-all.c4p--datagrid__select-all-sticky-left {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@
}

.#{$block-class}__head-hidden-select-all {
min-width: $spacing-09;
padding-right: $spacing-09;

&.#{$block-class}__select-all-sticky-left {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,6 @@ describe(componentName, () => {
.getByRole('table')
.getElementsByTagName('thead')[0]
.getElementsByTagName('tr')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('th')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('input')[0]
Expand All @@ -1009,7 +1008,6 @@ describe(componentName, () => {
.getByRole('table')
.getElementsByTagName('thead')[0]
.getElementsByTagName('tr')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('th')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('input')[0]
Expand Down Expand Up @@ -1994,7 +1992,6 @@ describe(componentName, () => {
.getByRole('table')
.getElementsByTagName('thead')[0]
.getElementsByTagName('tr')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('th')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('label')[0]
Expand All @@ -2017,7 +2014,6 @@ describe(componentName, () => {
.getByRole('table')
.getElementsByTagName('thead')[0]
.getElementsByTagName('tr')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('th')[0]
.getElementsByTagName('div')[0]
.getElementsByTagName('label')[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SelectAll = (datagridState: DataGridState) => {
columns[0]?.sticky === 'left' && withStickyColumn;
if (hideSelectAll || radio) {
return (
<div
<th
className={cx(`${blockClass}__head-hidden-select-all`, {
[`${blockClass}__select-all-sticky-left`]:
/* istanbul ignore next */
Expand Down Expand Up @@ -91,7 +91,8 @@ const SelectAll = (datagridState: DataGridState) => {
};

return (
<div
<TableSelectAll
{...selectProps}
className={cx(
`${blockClass}__head-select-all`,
`${blockClass}__checkbox-cell`,
Expand All @@ -101,15 +102,11 @@ const SelectAll = (datagridState: DataGridState) => {
isFirstColumnStickyLeft && Number(windowSize) > 671,
}
)}
>
<TableSelectAll
{...selectProps}
name={`${tableId}-select-all-checkbox-name`}
onSelect={handleSelectAllChange}
disabled={isFetching || selectProps?.disabled}
id={`${tableId}-select-all-checkbox-id`}
/>
</div>
name={`${tableId}-select-all-checkbox-name`}
onSelect={handleSelectAllChange}
disabled={isFetching || selectProps?.disabled}
id={`${tableId}-select-all-checkbox-id`}
/>
);
};

Expand Down

0 comments on commit 137f5b1

Please sign in to comment.