Skip to content

[EuiDataGrid] Fix copy/paste column alignment with control columns - #9954

Open
weronikaolejniczak wants to merge 3 commits into
elastic:mainfrom
weronikaolejniczak:fix/9951-datagrid-copy-alignment
Open

[EuiDataGrid] Fix copy/paste column alignment with control columns#9954
weronikaolejniczak wants to merge 3 commits into
elastic:mainfrom
weronikaolejniczak:fix/9951-datagrid-copy-alignment

Conversation

@weronikaolejniczak

@weronikaolejniczak weronikaolejniczak commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • What: EuiDataGrid copy/paste no longer includes control columns.
  • Why: Fixes Copy/paste from EuiDataGrid needs cleanup in a spreadsheet #9951 (with control columns present, copied body rows were shifted one column right of the headers)
  • How: Exclude control cells from tabular copy; emit the row newline from the last data column.

API Changes

N / A

Screenshots

Screenshot 2026-08-25 at 13 24 01

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes
  • 💅 Visual changes
  • 🧪 Test impact
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 Low
Kibana test PR: elastic/kibana#288094

Release Readiness

  • Documentation: EuiDataGrid
  • Figma:
  • Migration guide:
  • Adoption plan (new features):

QA instructions for reviewer

Open the Data grid playground with leading + trailing control columns.

  • Select from the first data header through body rows, copy, paste into a spreadsheet.
  • Headers align with body values (no extra empty first body column / last header cell).
  • Control chrome (checkboxes, "Row actions") is not pasted.
  • Full-grid select/copy: same data-only TSV.
  • Grid with no control columns: copy output unchanged.

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

Kibana Regression Integration Test

Status: 💚 Kibana CI passed
Branch: update-dependencies/1788257342
Kibana PR: elastic/kibana#288309

@weronikaolejniczak
weronikaolejniczak force-pushed the fix/9951-datagrid-copy-alignment branch from 7dfe431 to aa4c15e Compare August 31, 2026 11:11
@weronikaolejniczak weronikaolejniczak added ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR and removed ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR labels Aug 31, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the fix/9951-datagrid-copy-alignment branch 2 times, most recently from 716a99d to bac649f Compare August 31, 2026 16:25
@weronikaolejniczak weronikaolejniczak added ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR and removed ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR labels Aug 31, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@weronikaolejniczak weronikaolejniczak added ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR and removed ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR labels Sep 1, 2026
@weronikaolejniczak
weronikaolejniczak marked this pull request as ready for review September 1, 2026 08:21
@weronikaolejniczak
weronikaolejniczak requested a review from a team as a code owner September 1, 2026 08:21
Copilot AI lite review requested due to automatic review settings September 1, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-copy boundaries.
  • 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.

Comment thread packages/eui/cypress/support/copy/select_and_copy.tsx Outdated
@weronikaolejniczak
weronikaolejniczak force-pushed the fix/9951-datagrid-copy-alignment branch from 6cb05f7 to 2809fbf Compare September 1, 2026 08:45
@weronikaolejniczak
weronikaolejniczak marked this pull request as draft September 1, 2026 09:27
@weronikaolejniczak
weronikaolejniczak marked this pull request as ready for review September 1, 2026 09:36
@weronikaolejniczak weronikaolejniczak added ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR and removed ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR labels Sep 1, 2026
weronikaolejniczak and others added 3 commits September 2, 2026 15:54
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>
@weronikaolejniczak
weronikaolejniczak force-pushed the fix/9951-datagrid-copy-alignment branch from 8cc3046 to de885fe Compare September 2, 2026 13:54
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy/paste from EuiDataGrid needs cleanup in a spreadsheet

2 participants