Skip to content

[EuiDataGrid] Copy focused cell value with Ctrl/Cmd+C - #9995

Merged
weronikaolejniczak merged 5 commits into
elastic:mainfrom
weronikaolejniczak:feat/datagrid-copy-focused-cell
Sep 8, 2026
Merged

weronikaolejniczak merged 5 commits into
elastic:mainfrom
weronikaolejniczak:feat/datagrid-copy-focused-cell

Conversation

@weronikaolejniczak

@weronikaolejniczak weronikaolejniczak commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

API Changes

N/A

Screenshots

N/A

Impact Assessment

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

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 Low

Release Readiness

  • Documentation: Cells & popovers
  • Figma:
  • Migration guide:
  • Adoption plan (new features):

QA instructions for reviewer

  1. Open any EuiDataGrid story or docs demo.
  2. Click a data cell so it is focused. Do not highlight text.
  3. Press Ctrl/Cmd+C. Paste. You should get that cell's visible text only.
  4. Select part of a cell's text. Copy. You should get the selection, not the full cell.
  5. Focus a control column cell (checkbox / expand). Copy. It should not copy that control cell.
  6. Open the keyboard shortcuts popover. Confirm Ctrl + C / "Copy the focused cell value".
  7. Select several cells and copy. Tabular TSV copy should still work.

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.

Made with Cursor

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

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.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

📷 2 visual difference(s) found

Look 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 review

euidatagrid (2 differences)

StoryDiff %BeforeAfterDiff
keyboard shortcuts desktop 1.44%
keyboard shortcuts mobile 5.31%

@weronikaolejniczak
weronikaolejniczak force-pushed the feat/datagrid-copy-focused-cell branch from 9f7fe23 to e73a02c Compare September 4, 2026 07:29
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

📷 2 visual difference(s) found

Look 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 review

euidatagrid (2 differences)

StoryDiff %BeforeAfterDiff
keyboard shortcuts desktop 1.44%
keyboard shortcuts mobile 5.31%

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.

🟢 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

@weronikaolejniczak
weronikaolejniczak marked this pull request as ready for review September 4, 2026 08:08
@weronikaolejniczak
weronikaolejniczak requested a review from a team as a code owner September 4, 2026 08:08
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

📷 2 visual difference(s) found

Look 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 review

euidatagrid (2 differences)

StoryDiff %BeforeAfterDiff
keyboard shortcuts desktop 1.44%
keyboard shortcuts mobile 5.31%

@weronikaolejniczak weronikaolejniczak changed the title [EuiDataGrid] Copy focused cell value with Ctrl/Cmd+C feat(datagrid): copy focused cell value with Ctrl/Cmd+C Sep 4, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the feat/datagrid-copy-focused-cell branch from 21da5ed to 54cbe6a Compare September 4, 2026 08:36
@weronikaolejniczak weronikaolejniczak changed the title feat(datagrid): copy focused cell value with Ctrl/Cmd+C [EuiDataGrid] Copy focused cell value with Ctrl/Cmd+C Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Kibana Regression Integration Test

Status: 💚 Kibana CI passed
Branch: update-dependencies/1788860556
Kibana PR: elastic/kibana#289758

@mgadewoll
mgadewoll self-requested a review September 7, 2026 07:10

@mgadewoll mgadewoll 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.

🟢 LGTM, works as expected. Thanks for the update!

@weronikaolejniczak weronikaolejniczak removed the ci:regression-integration-test-kibana Run a Regression Integration Test in Kibana against this PR label Sep 8, 2026
@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 8, 2026
@weronikaolejniczak

Copy link
Copy Markdown
Contributor Author

🟢 Build succeeded in Kibana. I will merge once EUI CI is green.

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@weronikaolejniczak
weronikaolejniczak merged commit b970f09 into elastic:main Sep 8, 2026
11 checks passed
@davismcphee

Copy link
Copy Markdown
Contributor

Thank you for this long awaited enhancement @weronikaolejniczak!

eokoneyo added a commit to elastic/kibana that referenced this pull request Sep 17, 2026
## 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]>
ppisljar pushed a commit to ppisljar/kibana that referenced this pull request Sep 21, 2026
## 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]>
weronikaolejniczak added a commit to boriskirov/eui that referenced this pull request Nov 11, 2026
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.

[EuiDataGrid] Add support for copying the focused cell's value with keyboard shortcut only

5 participants