fix: Respect minWidth for dynamically added columns in resizable mode#4241
Open
kaigritun wants to merge 1 commit intocloudscape-design:mainfrom
Open
fix: Respect minWidth for dynamically added columns in resizable mode#4241kaigritun wants to merge 1 commit intocloudscape-design:mainfrom
kaigritun wants to merge 1 commit intocloudscape-design:mainfrom
Conversation
…le mode When columns are dynamically added to a table with resizableColumns enabled, the minWidth property is now correctly applied, consistent with the initial render behavior in readWidths(). Previously, dynamically added columns without explicit width would default to DEFAULT_COLUMN_WIDTH (120px) even if they had a minWidth property set. Fixes cloudscape-design#4236
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4241 +/- ##
=======================================
Coverage 97.19% 97.19%
=======================================
Files 886 886
Lines 26017 26019 +2
Branches 9431 9431
=======================================
+ Hits 25287 25289 +2
- Misses 683 724 +41
+ Partials 47 6 -41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #4236
When columns are dynamically added to a table with
resizableColumnsenabled, theminWidthproperty was being ignored. Instead, columns defaulted toDEFAULT_COLUMN_WIDTH(120px) even when they had aminWidthproperty set.Problem
In
use-column-widths.tsx, the code path for dynamically added columns (line ~171) only checkedcolumn.width:This is inconsistent with the initial render behavior in
readWidths()(lines 27-32), which correctly handlesminWidth:Solution
Apply the same logic to dynamically added columns, ensuring
minWidthis respected consistently:Testing
Added a new test case
should respect minWidth for dynamically added columns without explicit widththat:minWidthbut no explicitwidthminWidthvalues instead of falling back toDEFAULT_COLUMN_WIDTHAll existing tests continue to pass.