Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiDataGrid] Reduce hidden SR text when copying text from multiple cells #6817

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/components/datagrid/__snapshots__/data_grid.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 1
</p>
Expand Down Expand Up @@ -767,6 +768,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 1
</p>
Expand Down Expand Up @@ -799,6 +801,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 2
</p>
Expand Down Expand Up @@ -831,6 +834,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 2
</p>
Expand Down Expand Up @@ -863,6 +867,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 3
</p>
Expand Down Expand Up @@ -895,6 +900,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 3
</p>
Expand Down Expand Up @@ -1247,6 +1253,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- leading, column 1, row 1
</p>
Expand Down Expand Up @@ -1285,6 +1292,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 2, row 1
</p>
Expand Down Expand Up @@ -1317,6 +1325,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 3, row 1
</p>
Expand Down Expand Up @@ -1357,6 +1366,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- trailing, column 4, row 1
</p>
Expand Down Expand Up @@ -1403,6 +1413,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- leading, column 1, row 2
</p>
Expand Down Expand Up @@ -1441,6 +1452,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 2, row 2
</p>
Expand Down Expand Up @@ -1473,6 +1485,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 3, row 2
</p>
Expand Down Expand Up @@ -1513,6 +1526,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- trailing, column 4, row 2
</p>
Expand Down Expand Up @@ -1559,6 +1573,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- leading, column 1, row 3
</p>
Expand Down Expand Up @@ -1597,6 +1612,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 2, row 3
</p>
Expand Down Expand Up @@ -1629,6 +1645,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 3, row 3
</p>
Expand Down Expand Up @@ -1669,6 +1686,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- trailing, column 4, row 3
</p>
Expand Down Expand Up @@ -1980,6 +1998,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 1
</p>
Expand Down Expand Up @@ -2012,6 +2031,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 1
</p>
Expand Down Expand Up @@ -2044,6 +2064,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 2
</p>
Expand Down Expand Up @@ -2076,6 +2097,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 2
</p>
Expand Down Expand Up @@ -2108,6 +2130,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 3
</p>
Expand Down Expand Up @@ -2140,6 +2163,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 3
</p>
Expand Down Expand Up @@ -2443,6 +2467,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 1
</p>
Expand Down Expand Up @@ -2475,6 +2500,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 1
</p>
Expand Down Expand Up @@ -2507,6 +2533,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 2
</p>
Expand Down Expand Up @@ -2539,6 +2566,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 2
</p>
Expand Down Expand Up @@ -2571,6 +2599,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- A, column 1, row 3
</p>
Expand Down Expand Up @@ -2603,6 +2632,7 @@ Array [
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- B, column 2, row 3
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ exports[`EuiDataGridBodyCustomRender treats \`renderCustomGridBody\` as a render
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
-
columnA, column 1, row 1
Expand Down Expand Up @@ -180,6 +181,7 @@ exports[`EuiDataGridBodyCustomRender treats \`renderCustomGridBody\` as a render
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
-
columnB, column 2, row 1
Expand Down Expand Up @@ -217,6 +219,7 @@ exports[`EuiDataGridBodyCustomRender treats \`renderCustomGridBody\` as a render
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
-
columnA, column 1, row 2
Expand Down Expand Up @@ -250,6 +253,7 @@ exports[`EuiDataGridBodyCustomRender treats \`renderCustomGridBody\` as a render
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
-
columnB, column 2, row 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ exports[`EuiDataGridBodyVirtualized renders 1`] = `
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- columnA, column 1, row 1
</p>
Expand Down Expand Up @@ -180,6 +181,7 @@ exports[`EuiDataGridBodyVirtualized renders 1`] = `
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- columnB, column 2, row 1
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ exports[`EuiDataGridCell renders 1`] = `
</div>
<p
class="emotion-euiScreenReaderOnly"
hidden=""
>
- someColumn, column 1, row 1
</p>
Expand Down
5 changes: 4 additions & 1 deletion src/components/datagrid/body/data_grid_cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const EuiDataGridCellContent: FunctionComponent<
setCellContentsRef: EuiDataGridCell['setCellContentsRef'];
isExpanded: boolean;
isDefinedHeight: boolean;
isFocused: boolean;
ariaRowIndex: number;
}
> = memo(
Expand All @@ -60,6 +61,7 @@ const EuiDataGridCellContent: FunctionComponent<
ariaRowIndex,
rowHeightUtils,
isDefinedHeight,
isFocused,
...rest
}) => {
// React is more permissible than the TS types indicate
Expand Down Expand Up @@ -92,7 +94,7 @@ const EuiDataGridCellContent: FunctionComponent<
/>
</div>
<EuiScreenReaderOnly>
<p>
<p hidden={!isFocused}>
{'- '}
<EuiI18n
token="euiDataGridCell.position"
Expand Down Expand Up @@ -660,6 +662,7 @@ export class EuiDataGridCell extends Component<
isExpandable,
isExpanded: popoverIsOpen,
isDetails: false,
isFocused: this.state.isFocused,
setCellContentsRef: this.setCellContentsRef,
rowHeightsOptions,
rowHeightUtils,
Expand Down
1 change: 1 addition & 0 deletions upcoming_changelogs/6817.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated `EuiDataGrid` to only render screen reader text announcing cell position if the cell is currently focused. This should improve the ability to copy and paste multiple cells without SR text.