Repository navigation
[EuiDataGrid] Copy focused cell value with Ctrl/Cmd+C - #9995
weronikaolejniczak merged 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Listener lifecycle, hidden-content fallback, and the inaccurate macOS shortcut label need correction.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds focused-cell copying to EuiDataGrid while preserving selections and excluding control cells.
Changes:
- Adds document-level copy handling and tests.
- Documents the shortcut and displays it in the shortcuts popover.
- Adds reusable Cypress clipboard commands.
File summaries
| File | Description |
|---|---|
cells-and-popovers.mdx |
Documents focused-cell copying. |
copy_focused_cell.ts |
Implements clipboard handling. |
copy_focused_cell.test.ts |
Tests copy conditions. |
data_grid.tsx |
Enables the copy hook. |
data_grid.spec.tsx |
Adds Cypress coverage. |
keyboard_shortcuts.tsx |
Adds the copy shortcut. |
keyboard_shortcuts.test.tsx.snap |
Updates shortcut snapshots. |
index.d.ts |
Declares clipboard commands. |
select_and_copy.tsx |
Implements clipboard commands. |
9995.md |
Adds the changelog entry. |
Review details
Suppressed comments (1)
packages/eui/src/components/datagrid/utils/copy_focused_cell.ts:38
- Every grid registers the same function object, so the browser deduplicates these listeners. If two grids are mounted, unmounting either one removes the sole listener and disables focused-cell copying for the grid that remains. Track the number of mounted subscribers (or otherwise scope listeners per instance) and remove the document listener only after the final grid unmounts.
document.addEventListener('copy', copyFocusedDataGridCell);
return () => {
document.removeEventListener('copy', copyFocusedDataGridCell);
- Files reviewed: 9/10 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
📷 2 visual difference(s) foundLook at the visual diff below. If everything is expected, run Approve visual changes to update baselines, re-run the job or make appropriate fixes. See the visual regression testing wiki for more information. Expand to revieweuidatagrid (2 differences)
|
9f7fe23 to
e73a02c
Compare
📷 2 visual difference(s) foundLook at the visual diff below. If everything is expected, run Approve visual changes to update baselines, re-run the job or make appropriate fixes. See the visual regression testing wiki for more information. Expand to revieweuidatagrid (2 differences)
|
6f0c13d to
4b06de6
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The focused-cell copy behavior is scoped appropriately and covered across unit, integration, documentation, and localization-facing UI changes.
Review details
- Files reviewed: 11/12 changed files
- Comments generated: 0 new
- Review effort level: Balanced
📷 2 visual difference(s) foundLook at the visual diff below. If everything is expected, run Approve visual changes to update baselines, re-run the job or make appropriate fixes. See the visual regression testing wiki for more information. Expand to revieweuidatagrid (2 differences)
|
21da5ed to
54cbe6a
Compare
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
54cbe6a to
81bce89
Compare
Kibana Regression Integration TestStatus: 💚 Kibana CI passed |
mgadewoll
left a comment
There was a problem hiding this comment.
🟢 LGTM, works as expected. Thanks for the update!
|
🟢 Build succeeded in Kibana. I will merge once EUI CI is green. |
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
|
Thank you for this long awaited enhancement @weronikaolejniczak! |
## Dependency updates `@elastic/eui` - v121.0.0 ⏩ v122.0.0 `@elastic/eui-illustrations` - v1.0.2 ⏩ v1.1.0 `@elastic/eui-test-helpers` - v1.6.0 ⏩ v1.7.0 ## Changes - Cherry-picked staged Kibana prep commits from `kibana-prep-commits`: - #288940 (`1fdf41c`) — type `EuiSuperSelect` refs as `EuiSuperSelectRef` following the breaking `ref` change in elastic/eui#9972 - #290240 (`54cae3c`) — update tests, page objects, the EUI i18n mapping, and translation files for the removed `euiSelectableListItem.checkedOption` screen-reader text (elastic/eui#9850) - Synced EUI i18n tokens: added `euiKeyboardShortcuts.cmd`, `euiKeyboardShortcuts.copyTitle`, and `euiKeyboardShortcuts.copyDescription` to `i18n_eui_mapping.tsx` and updated the `i18n_service` snapshot ## Package updates ### `@elastic/eui` [v122.0.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Added Ctrl/Cmd+C support on `EuiDataGrid` to copy the focused cell value when no text is selected ([#9995](elastic/eui#9995)) **Bug fixes** - Fixed `EuiDataGrid` copy/paste shifting body rows one column right of the headers when control columns were present ([#9954](elastic/eui#9954)) **Breaking changes** - Changed the `ref` of `EuiSuperSelect` from the class instance to an `EuiSuperSelectRef` object, which exposes `openPopover()` and `closePopover()` ([#9972](elastic/eui#9972)) **Accessibility** - Improved the accessibility of `EuiSelectable` by removing redundant "Checked option." screen-reader text (checked state is already conveyed via `aria-checked`/`aria-selected`) ([#9850](elastic/eui#9850)) - Improved the accessibility of `EuiSelectable` and `EuiComboBox` by moving the `title` attribute to the inner text element, preventing duplicate screen-reader announcements of option names ([#9850](elastic/eui#9850)) ### `@elastic/eui-illustrations` [v1.1.0](https://github.com/elastic/eui/blob/main/packages/illustrations/changelogs/CHANGELOG_2026.md) - Added `attachments`, `detection`, `discovery`, `fieldExtraction`, `generatePreview`, `knowledgeIndicator`, `noData`, `processorsError`, `processorsLoading`, and `processorsPreview` illustrations ([#10001](elastic/eui#10001)) ### `@elastic/eui-test-helpers` [v1.7.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md) - Added `EuiTreeViewObject`, a Playwright Component Object for `EuiTreeView` ([#10025](elastic/eui#10025)) - Added `EuiToolTipObject`, a Playwright Component Object for `EuiToolTip` ([#10026](elastic/eui#10026)) - Added `EuiContextMenuObject`, a Playwright Component Object for `EuiContextMenu` ([#10013](elastic/eui#10013)) - Added `EuiColorPickerObject`, a Playwright Component Object for `EuiColorPicker` ([#10020](elastic/eui#10020)) **Bug fixes** - Fixed Component Objects not finding components whose `data-test-subj` holds several space-separated tokens, such as `EuiColorPicker`. The root now matches one token, following Kibana's `data-test-subj` convention ([#10015](elastic/eui#10015)) --------- Co-authored-by: Weronika Olejniczak <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Alexey Antonov <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
## Dependency updates `@elastic/eui` - v121.0.0 ⏩ v122.0.0 `@elastic/eui-illustrations` - v1.0.2 ⏩ v1.1.0 `@elastic/eui-test-helpers` - v1.6.0 ⏩ v1.7.0 ## Changes - Cherry-picked staged Kibana prep commits from `kibana-prep-commits`: - elastic#288940 (`1fdf41c`) — type `EuiSuperSelect` refs as `EuiSuperSelectRef` following the breaking `ref` change in elastic/eui#9972 - elastic#290240 (`54cae3c`) — update tests, page objects, the EUI i18n mapping, and translation files for the removed `euiSelectableListItem.checkedOption` screen-reader text (elastic/eui#9850) - Synced EUI i18n tokens: added `euiKeyboardShortcuts.cmd`, `euiKeyboardShortcuts.copyTitle`, and `euiKeyboardShortcuts.copyDescription` to `i18n_eui_mapping.tsx` and updated the `i18n_service` snapshot ## Package updates ### `@elastic/eui` [v122.0.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Added Ctrl/Cmd+C support on `EuiDataGrid` to copy the focused cell value when no text is selected ([elastic#9995](elastic/eui#9995)) **Bug fixes** - Fixed `EuiDataGrid` copy/paste shifting body rows one column right of the headers when control columns were present ([elastic#9954](elastic/eui#9954)) **Breaking changes** - Changed the `ref` of `EuiSuperSelect` from the class instance to an `EuiSuperSelectRef` object, which exposes `openPopover()` and `closePopover()` ([elastic#9972](elastic/eui#9972)) **Accessibility** - Improved the accessibility of `EuiSelectable` by removing redundant "Checked option." screen-reader text (checked state is already conveyed via `aria-checked`/`aria-selected`) ([elastic#9850](elastic/eui#9850)) - Improved the accessibility of `EuiSelectable` and `EuiComboBox` by moving the `title` attribute to the inner text element, preventing duplicate screen-reader announcements of option names ([elastic#9850](elastic/eui#9850)) ### `@elastic/eui-illustrations` [v1.1.0](https://github.com/elastic/eui/blob/main/packages/illustrations/changelogs/CHANGELOG_2026.md) - Added `attachments`, `detection`, `discovery`, `fieldExtraction`, `generatePreview`, `knowledgeIndicator`, `noData`, `processorsError`, `processorsLoading`, and `processorsPreview` illustrations ([elastic#10001](elastic/eui#10001)) ### `@elastic/eui-test-helpers` [v1.7.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md) - Added `EuiTreeViewObject`, a Playwright Component Object for `EuiTreeView` ([elastic#10025](elastic/eui#10025)) - Added `EuiToolTipObject`, a Playwright Component Object for `EuiToolTip` ([elastic#10026](elastic/eui#10026)) - Added `EuiContextMenuObject`, a Playwright Component Object for `EuiContextMenu` ([elastic#10013](elastic/eui#10013)) - Added `EuiColorPickerObject`, a Playwright Component Object for `EuiColorPicker` ([elastic#10020](elastic/eui#10020)) **Bug fixes** - Fixed Component Objects not finding components whose `data-test-subj` holds several space-separated tokens, such as `EuiColorPicker`. The root now matches one token, following Kibana's `data-test-subj` convention ([elastic#10015](elastic/eui#10015)) --------- Co-authored-by: Weronika Olejniczak <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Alexey Antonov <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Cursor <[email protected]> Co-authored-by: kibanamachine <[email protected]>






Summary
copylistener (same pattern as tabular copy). Reads[data-datagrid-cellcontent]. Does not run if text is selected, the cell is a control column, or focus is inside an interactive child.onCellCopyAPI in this PR. That can be a follow-up if consumers need raw values.API Changes
N/A
Screenshots
N/A
Impact Assessment
Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.
Impact level: 🟢 Low
Release Readiness
Figma:Migration guide:Adoption plan (new features):QA instructions for reviewer
Checklist before marking Ready for Review
Breaking changes: Addedbreaking changelabel (if applicable)Reviewer checklist
Made with Cursor