elastic / elastic/eui

[EuiDataGrid] Grid grows to infinite height in flex container if `height` not provided

Open
#7,769 2 comments 2 reactions 0 assignees View on GitHub
data grid known issue stale-issue
Dominant language
TypeScript
Stars
6.4k
Forks
911
Avg merge
2d 11h
Merged PRs (30d)
65

Description

**Describe the bug**
Using an `EuiDataGrid` within a `` with a sibling component will cause a feedback loop of some kind whereby the DataGrid will grow infinitely.

https://github.com/elastic/eui/assets/1937355/fe35b473-fb6f-46fb-9f88-f15f6fb99b93

**Impact and severity**
A component tree as simple as this completely breaks the entire page (pseudocode):

```html






```

The fix is to simply specify a height on the Data Grid:

```suggestion




-
+

```

You could also simply wrap the Data Grid in a non-flex container:
```suggestion




+



+


```

**Environment and versions**
- EUI version: latest
- React version: latest
- Browser: Chrome (at least)
- Operating System: all

**Minimum reproducible sandbox**
- Broken version: https://codesandbox.io/p/sandbox/black-glitter-kz96fj?file=%2Fdemo.tsx%3A391%2C1-392%2C1
- Version with `height="auto"` fix (from @cee-chen): https://codesandbox.io/p/sandbox/blissful-orla-4z88s6?file=%2Fdemo.tsx%3A407%2C17-407%2C88

**Additional context**
If the bug is "too deep" to fix, as suggested in the thread, it maybe be useful to require a height prop,or at least call this out in the docs. Thanks for your time!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.