Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Discrepancy between data grid virtualScroller height and overlay #15916

Open
timozander opened this issue Dec 17, 2024 · 1 comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@timozander
Copy link

timozander commented Dec 17, 2024

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-fqwwfbhv?file=Demo.tsx
  2. Issue is immediately visible

Current behavior

The docs state that

By default, the Data Grid has no intrinsic dimensions. Instead, it takes up the space given by its parent.

(source)

However, at the same time it states

When data grid has no content, overlays (such as "Loading" or "No rows") take the height of two rows by default.

(source)

As a consequence, if I have pinned columns (that have a background via the filler container) and have no rows, the virtual spacer pushes away the background:

Screenshot 2024-12-17 at 07 48 41

Expected behavior

It seems like these two are not aligned: Either the grid, by default, should take all the space of the parents (and therefore, so should the virtual scroller), or it should completely shrink down to two rows. However, it now is in this weird middle ground.

It's manually fixable by setting the --DataGrid-overlayHeight, but IMO this visual issue should not be the default.

Context

A data grid with a pinned action column that may at times be empty, therefore being visually off.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.7.1
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 131.0.6778.140
    Edge: Not Found
    Safari: 17.6
  npmPackages:
    @emotion/react: ^11.11.4 => 11.14.0
    @emotion/styled: ^11.11.5 => 11.14.0
    @mui/base:  5.0.0-beta.66
    @mui/core-downloads-tracker:  6.2.0
    @mui/icons-material: ^6.2.0 => 6.2.0
    @mui/lab: ^6.0.0-beta.19 => 6.0.0-beta.19
    @mui/material: ^6.2.0 => 6.2.0
    @mui/private-theming:  6.2.0
    @mui/styled-engine:  6.2.0
    @mui/system: ^6.2.0 => 6.2.0
    @mui/types:  7.2.19
    @mui/utils:  6.2.0
    @mui/x-data-grid:  7.23.2
    @mui/x-data-grid-premium: ^7.23.2 => 7.23.2
    @mui/x-data-grid-pro:  7.23.2
    @mui/x-date-pickers:  7.23.2
    @mui/x-date-pickers-pro: ^7.23.2 => 7.23.2
    @mui/x-internals:  7.23.0
    @mui/x-license: ^7.23.2 => 7.23.2
    @types/react: ~18.3.16 => 18.3.16
    react: ^18.3.1 => 18.3.1
    react-dom: ^18.3.1 => 18.3.1
    typescript: ^5.7.2 => 5.7.2

Firefox and Chrome

Order ID: 95800
Search keywords: data grid, overlay, no rows, virtual scroller, virtualscroller

@timozander timozander added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 17, 2024
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Dec 17, 2024
@michelengelen
Copy link
Member

I agree that this should be handled internally.

For now you can fix this by applying a background color to the overlayWrapperInner class.

I'll add it to the board! 👍🏼

@michelengelen michelengelen added feature: Rendering layout Related to the data grid Rendering engine and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 17, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Dec 17, 2024
@michelengelen michelengelen changed the title Discrepancy between data grid virtualScroller height and overlay [data grid] Discrepancy between data grid virtualScroller height and overlay Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

2 participants