Accept vertical-first edge offsets in background-position - #210
Merged
TylerBrinks merged 1 commit intoJul 23, 2026
Conversation
The 3- and 4-value background-position syntax positions each axis by an
edge keyword and an optional offset, combined with "&&" - so the two
axes may appear in either order (CSS Backgrounds 3 3.6). PointConverter
had the horizontal-first forms ("right 20px bottom 10px") but not their
vertical-first mirrors, so "bottom 10px right", "bottom right 20px" and
"bottom 10px right 20px" were rejected.
Add the three mirrored WithOrder cases. Two components on the same axis
("left right", "left 10px right 20px") remain invalid.
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.
Problem
The 3-/4-value
background-positionsyntax positions each axis by an edge keyword plus an optional offset, combined with&&— so the two axes may appear in either order (CSS Backgrounds 3 §3.6):The horizontal-first forms work, but their vertical-first mirrors are rejected:
PointConverterhasWithOrder(hi, vi, …)/WithOrder(hi, <lp>, vi, …)for the horizontal-first cases but no vertical-first equivalents.Fix
Add the three mirrored
WithOrdercases (vi hi <lp>,vi <lp> hi,vi <lp> hi <lp>) after the existing horizontal-first ones.Two components on the same axis stay invalid —
left right,top bottom,bottom 10px top,left 10px right 20pxare all still rejected.Tests
9 cases in
PropertyTests/BackgroundProperty.cs: 5 vertical-first legal forms and 4 same-axis-twice illegal ones. The 5 legal cases fail onmaster; the illegal guards pass both ways. The full suite (1263 existing tests) stays green, and all seven target frameworks build with no new warnings.PointConverteralso backsradial-gradient/conic-gradientpositions, which gain the same symmetry.