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

Column auto size not working on Firefox #3409

Open
holospice18 opened this issue Dec 22, 2023 · 3 comments
Open

Column auto size not working on Firefox #3409

holospice18 opened this issue Dec 22, 2023 · 3 comments
Labels

Comments

@holospice18
Copy link

Describe the bug

Auto size on Firefox does not work unless 'size' is defined

On Chrome column size is defined by cell content
On Firefox column size is defined by Grid

Chrome
image

Firefox
image

@amanmahajan7
Copy link
Contributor

react-data-grid uses auto as the default width. This looks like a bug in FF and not in react-data-grid.

@jcharry
Copy link

jcharry commented Feb 16, 2024

@amanmahajan7 even if it is a browser bug, any ideas how to work around this? We're currently witnessing the same behavior. I've tried setting min-width: fit-content on the gridcell and column header and that actually seems to fix things on safari and firefox, but then it breaks on chrome.

Update:
Seemingly got this to work by setting min-width: min-content; on gridcell and columheader:

{
  [role='gridcell'] {
    min-width: min-content;
  }
  [role='columnheader'] {
    min-width: min-content;
  }
}

YMMV - I haven't tested this throughly, and it likely has the effect of disallowing a column from ever overflowing, which maybe won't work for all use cases. But for our specific use case of requiring that cell content never overflows it seems to work.

@amanmahajan7
Copy link
Contributor

You can try using <DataGrid defaultColumnOptions={{ width: ''max-content' }} ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants