[EuiDataGrid] Rows overlap each over
- Dominant language
- TypeScript
- Stars
- 6.4k
- Forks
- 911
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 69
Description
**Describe the bug**
The rows overlap in `EuiDataGrid` when the density is set to "Compact" and there's a badge in the data. It is reproducible only in `8.18` Kibana version, and therefore `v98.2.1-borealis.1` EUI version.
It happens on first render and when you start playing with display options, the rows display correctly.
**Impact and severity**
Impact is **low**. Severity is **low**.
It targets a specific Kibana version - `8.18`. Not reproducible on `main`. There is a known workaround, specifically:
> Setting `overflow: hidden` on `.euiDataGridRowCell` helps to address the visual text overlap. Still wonder why some rows don't grow more than 1 line on the first render.
This workaround is not robust because it hides the cell actions:

**Environment and versions**
- **EUI version:** `v98.2.1-borealis.1` _(See [8.18](https://github.com/elastic/kibana/blob/8.18/package.json#L125))_
- **React version:** `18.2.0` _(Other React versions not tested)_
- **Kibana version (if applicable):** `8.18.0`
- **Browser:** Chrome, Safari _(Firefox not tested)_
- **Operating System:** MacOS _(Windows not tested)_
**Minimum reproducible sandbox**
[Codesandbox](https://codesandbox.io/p/sandbox/eager-euler-mj3k9h)
There's another issue that can be reproduced there that targets `8.18`: https://github.com/elastic/eui/pull/8251
"Lines per row" has to be set to "auto".
**To Reproduce**
Steps to reproduce the behavior:
1. Go to the [8.18 overview cluster](https://overview.elastic-cloud.com/s/observability-ux/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(breakdownField:log.level,columns:!(),dataSource:(dataViewId:discover-observability-solution-all-logs,type:dataView),density:normal,filters:!(),headerRowHeight:5,hideChart:!f,interval:auto,query:(language:kuery,query:''),rowHeight:-1,sort:!(!('@timestamp',desc)))).
2. Log in with Okta.
3. Click on "Display options" button in the data grid.
4. Select "Compact" density in the popover.
5. Reload the page.
https://github.com/user-attachments/assets/56f2491b-ee8a-461b-8f3a-470651332600
**Expected behavior**
The rows don't overlap each other.
**Additional context**
- The bug is not reproducible in the latest EUI versions.
- > Maybe there is some kind of a race condition: what available space does Discover has and how to fit the data grid into it. I just noticed that the grid size grows on the first render.
Contributor guide
Assessment
This issue has not been assessed yet.