iTwin / iTwinUI

A design system for building beautiful and well-working web interfaces.
https://itwin.github.io/iTwinUI/
MIT License
101 stars 37 forks source link

Table: Issue in column Resizing when there is action manager in columns #2032

Open Charan-ts opened 2 months ago

Charan-ts commented 2 months ago

Describe the bug (current behavior)

The Table component, along with its columns and action manager, encounters an issue with column toggling. When a column is resized and then all columns are deselected, followed by selecting all columns in the action manager, the column fails to appear in the UI.

Video of issue: https://github.com/iTwin/iTwinUI/assets/91957106/70b8abb6-1463-4db3-8829-3c92ed3df220

Expected Behavior

The action manager should correctly display the selected columns in the UI after they have been deselected

Link to minimal repro

https://codesandbox.io/p/sandbox/table-column-resizing-xwt7g5?file=%2Fsrc%2FApp.tsx%3A11%2C27

Steps To Reproduce

  1. Create several columns within the action manager.
  2. Before deselecting all the columns in the action manager, resize any of the columns.
  3. Then proceed to deselect all the columns in the action manager.
  4. Finally, select all the columns again within the action manager.
Ben-Pusey-Bentley commented 2 months ago

Hello, thanks for filing this issue. I am able to reproduce this issue with the sandbox that you have linked. I did want to add that the reason that the columns are failing to appear in the UI is because the index column is becoming wider with each removed column, eventually filing up the entire table. It can be resized afterwards to make the columns appear again. Video:

https://github.com/iTwin/iTwinUI/assets/141063311/a33bd374-d2cf-40ac-a1c7-51c2d42a9304

@mayank99 I know that you worked on Table column resizing recently. Any ideas on workarounds for this issue?

Also wanted to clarify that even though the provided sandbox is using version 2, I have confirmed that the issue persists in version 3. Sandbox link: https://codesandbox.io/p/sandbox/table-column-resizing-forked-hpkwqc

mayank99 commented 2 months ago

@mayank99 I know that you worked on Table column resizing recently. Any ideas on workarounds for this issue?

I didn't work on the resizing logic itself, but one workaround might be to set a maxWidth to prevent the column from becoming too wide.

In any case, we should investigate this issue and find a proper fix.

It's also possible that the Table's resizing logic is faulty at its core, since we keep finding so many issues with it: