[EuiDataGrid] Fix copy/paste column alignment with control columns - #9954
[EuiDataGrid] Fix copy/paste column alignment with control columns#9954weronikaolejniczak wants to merge 3 commits into
Conversation
Kibana Regression Integration TestStatus: 💚 Kibana CI passed |
7dfe431 to
aa4c15e
Compare
716a99d to
bac649f
Compare
💚 Build Succeeded
History
|
There was a problem hiding this comment.
🟡 Changes recommended
The updated Cypress selectAndCopy range logic can unintentionally select content outside the target element when startSelector is used, risking flaky copy assertions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes EuiDataGrid tabular copy/paste output when leading/trailing control columns are present by excluding control columns from the copied TSV and ensuring row newlines are emitted from the last data column (not the last visible column).
Changes:
- Exclude control column header/body cells from tabular copy via
no-copyboundaries. - Emit tab/newline markers based on the last data column (
isLastCopyColumn) to keep headers/body aligned with control columns present. - Add/extend Cypress + Jest test coverage for copy behavior (including regression for #9951) and update snapshots/changelog.
File summaries
| File | Description |
|---|---|
| packages/eui/src/components/datagrid/data_grid.spec.tsx | Expands Cypress coverage to verify data-only copy output with control columns. |
| packages/eui/src/components/datagrid/data_grid_copy.test.tsx | Adds Jest regression test for tabular copy alignment with control columns. |
| packages/eui/src/components/datagrid/body/header/data_grid_header_cell.tsx | Ensures newline marker is emitted from the last data header cell even when trailing control columns exist. |
| packages/eui/src/components/datagrid/body/header/data_grid_header_cell.test.tsx | Adds unit test asserting newline marker comes from last data column. |
| packages/eui/src/components/datagrid/body/header/data_grid_header_cell_wrapper.tsx | Adds control-column handling to emit no-copy boundaries instead of tab/newline markers. |
| packages/eui/src/components/datagrid/body/header/data_grid_header_cell_wrapper.test.tsx | Tests that control headers are excluded from tabular copy markers. |
| packages/eui/src/components/datagrid/body/header/data_grid_control_header_cell.tsx | Marks control header cells as control columns for tabular copy behavior. |
| packages/eui/src/components/datagrid/body/header/data_grid_control_header_cell.test.tsx | Updates snapshot expectations for control header copy markers. |
| packages/eui/src/components/datagrid/body/footer/data_grid_footer_row.tsx | Passes isLastCopyColumn through footer cells to align copy row termination. |
| packages/eui/src/components/datagrid/body/cell/data_grid_cell.tsx | Uses isLastCopyColumn and excludes control cells from tabular copy markers. |
| packages/eui/src/components/datagrid/body/cell/data_grid_cell_wrapper.tsx | Computes isLastCopyColumn based on data-column position (ignoring trailing controls). |
| packages/eui/src/components/datagrid/snapshots/data_grid.test.tsx.snap | Updates snapshots for new no-copy markers in control columns. |
| packages/eui/cypress/support/index.d.ts | Updates Cypress selectAndCopy typing to optionally start selection from a selector. |
| packages/eui/cypress/support/copy/select_and_copy.tsx | Updates Cypress selection helper to support a start selector for copy range. |
| packages/eui/changelogs/upcoming/9954.md | Adds changelog entry for the copy/paste alignment fix. |
Review details
- Files reviewed: 14/15 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6cb05f7 to
2809fbf
Compare
Control columns still emitted tab/newline copy markers, so a typical selection starting at the first data header shifted body cells one column right of the headers. Exclude those columns from tabular copy and put the row newline on the last data column, without adding public props or CSS. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The autofix duplicated the else branch and Cypress webpack failed to parse support files, so every spec crashed. Co-authored-by: Cursor <cursoragent@cursor.com>
8cc3046 to
de885fe
Compare
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
Summary
EuiDataGridcopy/paste no longer includes control columns.API Changes
N / A
Screenshots
Impact Assessment
Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.
Impact level: 🟢 Low
Kibana test PR: elastic/kibana#288094
Release Readiness
Figma:Migration guide:Adoption plan (new features):QA instructions for reviewer
Open the Data grid playground with leading + trailing control columns.
Checklist before marking Ready for Review
QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Edge/Firefox, keyboard-only, screen readerQA: Tested docs changesBreaking changes: Addedbreaking changelabel (if applicable)Reviewer checklist