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

Table column overflow when using sticky header inside flexbox #36599

Closed
Eliepse opened this issue Jul 19, 2022 · 4 comments
Closed

Table column overflow when using sticky header inside flexbox #36599

Eliepse opened this issue Jul 19, 2022 · 4 comments

Comments

@Eliepse
Copy link

Eliepse commented Jul 19, 2022

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  • Use a table inside a flex container such as the width is flexible (see the example).
  • Resize the view (increase the width)
  • Resize the view (decrease the width)

What is expected?

The columns should resize when the view width decrease, and therefore adapt to the table's parent container.

What is actually happening?

The table columns does not resize, they overflow the table container.

Environment Info
antd 4.21.7
React 18.2.0
System Windows 11
Browser Chromium, Firefox

The problem seem to come from the "colspan" of the column headers.

When I manually remove the "fixed" layout of the sticky header, the table works fine. I guess it has to be a bug in the react code then, not in the style.

Setting the container as "overflow: hidden" fix the issue, but then disable the sticky headers.

@github-actions
Copy link
Contributor

You may look for issues:

  1. 54% Table with sticky header: filter dropdown positions incorrectly on scroll #29366

🤖 By issues-similarity-analysis

@Eliepse
Copy link
Author

Eliepse commented Jul 19, 2022

Just tested with CSS Grid with a similar layout, the problem is still here.

@afc163 afc163 closed this as completed Jul 20, 2022
@afc163 afc163 mentioned this issue Jul 20, 2022
19 tasks
@Eliepse
Copy link
Author

Eliepse commented Jul 20, 2022

It works! Thanks for the fix.

For the one arriving on this issue, the solution is to set min-width: 0; on the flex children (or grid children) that holds the table. I don't understand why, the fix is a bit strange to me but it works :-)

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

No branches or pull requests

2 participants