Constrain the grid track when line-numbers is absent - #31
Open
bluzername wants to merge 1 commit into
Open
Conversation
Without line-numbers, :host had no grid-template-columns, so its single implicit column sized itself to the pre content (auto track, non-flexible), same track behavior a plain block would have. With line-numbers the second column already use minmax(0, 1fr), a flexible track, which let the pre shrink to fit. Give the base :host the same minmax(0, 1fr) so both case behave the same and the element stay inside its container even with an unbroken long line. Added a fixture (no page-level pre overflow rule, on purpose) and a test that check the pre element's own box do not spill past its container. It fail on main and pass with the fix. Fixes davatron5000#25
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.
Fixes #25.
Without
line-numbers,:hosthad nogrid-template-columns, so its single implicit column just size itself to the pre content (a plainautotrack, not flexible). Withline-numbersthe second column already useminmax(0, 1fr), a flexible track, which let the pre shrink to fit the available space instead. That is exactly why the reporter see it work with line-numbers but not without.Fix is one line: give the base
:hostthe sameminmax(0, 1fr)track, so both case behave the same.Added a fixture (
test/fixtures/no-line-numbers-width.html, intentionally with no page-levelpreoverflow rule, same idea as the existing grammar-exhaustive fixture) and a test that check the pre element own box do not spill past its container when there is a long unbroken line and no line-numbers. Confirmed it fail on main and pass with the fix (checked by stashing the src change).npm testis green (33/33).