fix(component): prevent column resizing when editing text field #991
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Sets Worksheet to
table-layout: fixed
and addminWidth
prop.Fixes this issue introduced by #975:
Why?
The bug is happening because I set
table-layout: auto
, which means the table will try to automatically fit the content in the table (this is cool if we want all columns to remain visible even when shrinking the window), and overflow what doesn't fit (so we get a scroll bar).Problem is that the
input
element is set towidth: 100%
and unless thetd
has a fixed width (set with the new width prop in the column), it won't calculate the 100% as I expected.What I'm doing is reverting the table to
table-layout: fixed
. The problem with fixed and having static width columns it that when the table shrinks in size it will shrink all auto columns to 0 to accommodate the fixed width columns.Like so:
To solve this I expose a
minWidth
prop for the Worksheet, so that we can set a minimum width. However this needs to be controlled by the developer, otherwise the issue above will happen.Table will still have a static width if all columns have static widths.
Fixed inputs:
Overall this feels like a good compromise. We added the ability to set fixed widths to columns but by doing so developer needs to be mindful of setting a min-width if viewport gets too shrunk for the table. I believe
minWidth
was long overdue because the Worksheet has been breaking this way since it was introduced.Testing/Proof
Locally.