elastic/eui

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

i-a-n opened this issue · 0 comments

Describe the bug
Using an EuiDataGrid within a <EuiFlexGroup direction='column'> with a sibling component will cause a feedback loop of some kind whereby the DataGrid will grow infinitely.

datagrid-height.mp4

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

<EuiFlexGroup direction="column">
  <EuiFlexItem>
    <EuiPanel>
      <EuiSearchBar />
      <EuiDataGrid />
    </EuiPanel>
  </EuiFlexItem>
</EuiFlexGroup>

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

<EuiFlexGroup direction="column">
  <EuiFlexItem>
    <EuiPanel>
      <EuiSearchBar />
-     <EuiDataGrid />
+     <EuiDataGrid height="auto" />
    </EuiPanel>
  </EuiFlexItem>
</EuiFlexGroup>

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

<EuiFlexGroup direction="column">
  <EuiFlexItem>
    <EuiPanel>
      <EuiSearchBar />
+      <div>
          <EuiDataGrid />
+      </div>
    </EuiPanel>
  </EuiFlexItem>
</EuiFlexGroup>

Environment and versions

  • EUI version: latest
  • React version: latest
  • Browser: Chrome (at least)
  • Operating System: all

Minimum reproducible sandbox

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!