fix: prevent negative flex-mode column widths from breaking CSS grid - #2293
Closed
surya-pabbineedi wants to merge 1 commit into
Closed
fix: prevent negative flex-mode column widths from breaking CSS grid#2293surya-pabbineedi wants to merge 1 commit into
surya-pabbineedi wants to merge 1 commit into
Conversation
Negative leftover delta in scaleColumns could produce widths < 0, which invalidates grid-template-columns in v25+ and collapses the layout. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
In flex mode,
scaleColumnscan leave a column width slightly (float noise) or largely (minWidth starvation) negative. In v25+, those widths are written into CSSgrid-template-columns/--ngx-datatable-grid-template-columns. A negative track invalidates the whole declaration, so the browser falls back to a single column: headers stack and body cells overlap.What is the new behavior?
scaleColumnsclamps widths withMath.max(0, …)(same guard asforceFillColumnWidths)deltais only applied toflexGrow > 0columns that can absorb it without going negativegridColumnTrackalso clamps so negative values never reach CSS even if math regressesDoes this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information:
Minimal fix only—no flexGrow-0 semantic change. Unit tests cover float/minWidth starvation cases, locked+flex distribution, and non-negative grid track strings.
Made with Cursor