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

Resized sticky columns overlap when scrolling horizontally #5392

Open
2 tasks done
SeanStove opened this issue Mar 5, 2024 · 4 comments
Open
2 tasks done

Resized sticky columns overlap when scrolling horizontally #5392

SeanStove opened this issue Mar 5, 2024 · 4 comments

Comments

@SeanStove
Copy link

TanStack Table version

v8.13.2

Framework/Library version

v18.2.0

Describe the bug and the steps to reproduce it

When columns are resized and pinned sticky, they start to overlap when scrolling.
You can reproduce this by going to the Column Pinning Sticky example from the docs.

  1. Resize the first two columns
  2. Pin them
  3. They overlap when you scroll

I'm not sure if this could be solved with css? Any help would be appreciated.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://tanstack.com/table/latest/docs/framework/react/examples/column-pinning-sticky

Screenshots or Videos (Optional)

tanstack-sticky-column-issue_tmCslzH3.mp4

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@xluk9
Copy link

xluk9 commented Apr 4, 2024

I have the same problem even without resizing them. Sticky column always overlap when horizontally scrolled.
Anybody have any workaround?

@irenako
Copy link

irenako commented Apr 16, 2024

Hello! I have the same issue with pinned columns on a horizontal scroll. I have noticed that when pinned column is resized, overlapping for this particular column is gone. Could you help to fix this?

@kaydev-io
Copy link

kaydev-io commented May 24, 2024

Running into this as well - best I can understand is this is happening when the table header / table content is unable to shrink down to the size specified by the column width. In the framework docs example, the smallest the first name column is able to actually shrink is ~112.188px, despite it internally setting lower sizes in table state. If you shrink it lower in state than in the dom, pinning for subsequent rows snaps to whatever the state thinks the width is, not what's actually happening in the dom.

Simple fix if it works for your project, check the minimum size of a given column, and provide a minSize that's larger than the smallest you can shrink a given row. For example, setting a minimum size of 120 for all table rows prevents this from happening in the documentation example.

Still trying to figure out how to resolve it in more complex situations / requirements, mostly seems like there has to be some extra check occurring on size updates to verify the element can get to that size, but it doesn't seem like there's an easy way to do that at this point through table settings.

@SeanStove
Copy link
Author

SeanStove commented May 25, 2024

As @kaydev-io mentions above, I also found out that the column.getSize() value gets out of sync with the actual width of the column.
You can keep dragging the resize handler, even if there's no more room to resize.

I've added a video to demonstrate this.
column.getSize() is added to the header of each column to show the value.
I can drag the width down to 20, which is the default minSize.

So when the following css is applied, the value passed to the left sticky position is not correct (I assume column.getStart is based on the width of the previous column)

left: isPinned === 'left' ? ``${column.getStart('left')}px`` : undefined

might be related #4825 #4880

Recording.2024-05-25.095334.mp4

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

4 participants