-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-backgrounds-4][css-values-4] Align logical values for <position> with the ones defined in CSS Logical Properties #549
Comments
This is addressed in CSS Backgrounds and Borders Level 4. |
Coming back to this issue, my point back then was to replace the half physical half logical keywords I also meant to simplify the syntax, though allowing to mix logical and physical keywords seems wrong to me now because this possibly causes similar issues as the keywords above. And I also kicked out the Sebastian |
Iterating on my previous suggestion, if we align the syntax with the current definition of <bg-position> = [
[ left | center | right | inline-start | inline-end ] ||
[ top | center | bottom | block-start | block-end ]
|
[ left | center | right | inline-start | inline-end | <length-percentage> ]
[ top | center | bottom | block-start | block-end <length-percentage> ]?
|
[ [ left | right | inline-start | inline-end ] <length-percentage>? ] &&
[ [ top | bottom | block-start | block-end ] <length-percentage>? ]
] In addition to that we might still have Sebastian |
No, x-start/y-start are intentionally not inline-start/block-start because they are logical directions along a physical axis. |
I know and I mentioned that earlier. The actual question is why do we have them? What are the use cases for mixing logical and physical axes here in contrast to basically everywhere else? Sebastian |
It's not mixing logical and physical axes. It's using physical axes and logical directions. There are some effects that are going to want that, e.g. consider a background that imitates a landscape. The grass is always going to be at the bottom, and the sun at the top, but you might want to position the sun right or left depending on the writing mode. |
Okay, here's my proposal for an updated
The logical additions are:
|
Oh and note, this is an expansion of the V&U definition of position, which we've slightly stripped down (removing the 3-value forms, for example). For bg-position we'll need to put back the 3-value stuff, but I propose we only do exactly what's needed for compat, rather than making logical keywords also have this weird behavior. |
Iterating on the proposal of @tabatkins: <position> = [
[ left | center | right | x-start | x-end ] || [ top | center | bottom | y-start | y-end ]
|
[ left | center | right | x-start | x-end | <length-percentage> ]
[ top | center | bottom | y-start | y-end | <length-percentage> ]?
|
[ [ left | center | right | x-start | x-end ] <length-percentage> ] &&
[ [ top | center | bottom | y-start | y-end ] <length-percentage> ]
|
[ block-start | block-end ] || [ inline-start | inline-end ]
|
[ start | end ]{1, 2}
|
[ [ block-start | block-end ] <length-percentage> ] &&
[ [ inline-start | inline-end ] <length-percentage> ]
|
[ [ start | end ] <length-percentage> ]{1, 2}
] Changes to Tab's suggestion:
Sebastian |
I tend to agree with Tab that the 3-value-syntax for background positions with its ambiguities should stay untouched. So I think the syntax for <bg-position> = [
<position>
|
[ left | right ] <length-percentage>? &&
[ top | bottom ] <length-percentage>?
] or to make the 3-value-syntax more obvious as <bg-position> = [
<position>
|
[ [ left | right ] <length-percentage> && [ top | bottom ] ] |
[ [ left | right ] && [ top | bottom ] <length-percentage> ]
] or even something like <bg-position> = <position> | <three-value-position>
<three-value-position> = [
[ [ left | right ] <length-percentage> && [ top | bottom ] ] |
[ [ left | right ] && [ top | bottom ] <length-percentage> ]
] Sebastian |
Adding this to the agenda, as I believe we now have a decent definition (see the last two comments). Sebastian |
I don't agree with this change (or the related one that lets them take a len-per), as it's different behavior from what a single keyword does in all other cases. In every other possibility, giving one keyword sets one axis and centers the other. I don't think being able to say "the start/start corner" is sufficiently important/common that literally saying
I disagree with this too. First, it seems unmotivated; I haven't seen anyone ask for this, and it doesn't close a glaring hole in the grammar so it's doesn't help technical correctness either. Second, the offsets for the existing keywords are offsets from an edge, with positive values pointing inward; whether that manifests as the value being syntax sugar for a positive or a negative term depends on which value it's for. There is no "inward" from center, tho, so there's no similar intuition to lean on. I think people can just write
Not redundant; your grammar disallows So in all I think that means I disagree with all of your changes, and we should just use mine. ^_^ |
Here's the proposed grammar for the full combination of physical and logical We decided that having them all as one giant production was just getting unmanageable, so we broke them up into three, one for each number of component values you can specify. This has the nice effect of making css-values and css-backgrounds grammars easier to integrate without duplication. ^_^
These would expand into For
And if we wanted to allow the (unambiguous) 3-value combinations with logical keywords too:
This grammar allows:
It's unambiguous whether you're expanding to the physical or logical longhands (as long as we define Because we know the writing mode at computed value time, the computed values for all properties could remain as from the top+left sides, which privileges physical coordinates but allows all coordinate types to be simply interpolated during animations. Alternatively, if we want to preserve the coordinate information at computed-value time:
~Tab and fantasai |
It is slowly getting a liiittle complicated to comprehend and keep up with everything. 😅 The split into different productions helps to grasp the changes. And thank you for adding the optional offset to I think it would help to give the data types more expressive names like [ block-start | center | block-end | <<length-percentage>> ]
[ inline-start | center | inline-end | <<length-percentage>> ] Regarding the positioning origin, I think authors would want the coordinate information to be preserved. I.e. the coordinate information should be inferred from the given keyword when possible and fall back to top left otherwise. By inferred I mean the origin is the So, for example, for a value of When interpolating, the coordinate information could also be preserved in case axes of the start and end value coincide. That means, animating from Sebastian |
I think there's a readability balance to be had between splitting things up and abstracting them vs writing them inline, and I think the production structure in Tab's grammar finds a good balance. It's also perfectly suited to hooking together the bg-position and position grammars.
See the
I think this is a bit too much magic, since if I replace |
To expand on what Elika said, note that We could potentially loosen that restriction across the board, but this is such an old production that I'd be legitimately afraid of accidentally activating currently-invalid code. It also runs into the ambiguity issue Elika was worried about - |
Just to make sure we're not talking past each other. I meant to rename
I was talking about a logical two-value complement to [ left | center | right | x-start | x-end | <<length-percentage>> ]
[ top | center | bottom | y-start | y-end | <<length-percentage>> ] So, e.g.
My point was just that we could define smart interpolation rules in case the start and end value "fit together", as shown in the example I gave, and fall back to the top left coordinate system if they don't. Though as long as authors can interpolate e.g. between Sebastian |
I skimmed through the last few messages, but since this is on the agenda for today, this my position:
|
There's also value to a) keeping things short enough that we don't trigger excessive wrapping, b) keeping things short enough that the name itself isn't as long as a sentence because that takes up a lot of space in your head when you're reading the sentence containing the name!
See #549 (comment) @LeaVerou I think you're confused wrt logical + physical combos. |
Not if there is a |
There is no Sebastian |
Hm, that's a larger issue for anything that could expand into both logical and physical longhands. I'll raise it on the Logical spec.
Right, that combo isn't allowed. If you're using a "full logical" keyword, it can only be used with its paired full-logical keyword. |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> TabAtkins: In the issue, specifically the comment at https://github.com//issues/549#issuecomment-1823607623<fantasai> TabAtkins: fantasai and I worked on final proposal to integrating logical values in to <position> and <bg-position> <fantasai> TabAtkins: I'm very happy with this in general, and most places where this will matter <fantasai> TabAtkins: e.g. in transform-origin or shapes <fantasai> TabAtkins: there's a question that Oriol raised about how this expands into longhands when you have both physical and logical <fantasai> TabAtkins: we haven't fully resolved how that's supposed to work <astearns> ack bkardell_ <fantasai> TabAtkins: background-position, given it has -x/-y, will presumably have -inline/-block <fantasai> TabAtkins: from syntax, it's obvious which to resolve to <fantasai> TabAtkins: but not obvious for var() <fantasai> TabAtkins: don't know which set to expand into until var() resolution <fantasai> TabAtkins: so further issue of how to handle in background-position, which I'd like to defer <fantasai> TabAtkins: but for <position> itself, I'm happy to resolve to accept this set of additions if ppl are happy <fantasai> me q+ <astearns> ack fantasai <TabAtkins> fantasai: I think that we need to somehow make this work, so we should just accept this syntax for both things then figure out var() resolution <TabAtkins> fantasai: Even if it's very dumb, at least it'll work for basic cases. Need logical bg positions <TabAtkins> TabAtkins: Yeah that's probably reasonable. <fantasai> astearns: so we would accept proposal in that comment, and then open up issues on var() resolution <fantasai> TabAtkins: already open <fantasai> astearns: Proposed to accept proposal <TabAtkins> fantasai: Summarizing: <TabAtkins> fantasai: the new syntax expands <position> to allow x-start/x-end/y-start/y-end as alternatives to left/right/top/bottom <TabAtkins> fantasai: It also adds block-start/block-end/inline-start/inline-end as a separate production which can't be mixed with the physical axis keywords <TabAtkins> fantasai: And as a shorthand also allows just "start start"/etc <TabAtkins> fantasai: Same pattern as in other logical props <TabAtkins> fantasai: So we can specify fully physical, specify physical axis but a logical side, or specify fully logical. Gives us every combination <TabAtkins> fantasai: But for the resolution I'd say just accept the proposal in the comment <SebastianZ> +1 <TabAtkins> astearns: Any reactions to that summary? <TabAtkins> astearns: Objections? <TabAtkins> RESOLVED: Accept the proposal in the comment <fantasai> -> https://github.com//issues/549#issuecomment-1823607623 |
I disagree, this isn't something that can be addressed in a quick follow-up. It's more or less the same problem as #1282, which has been open for 6.5 years with still no clear proposal. So I'm opposed to adding logical values with no plan about how to handle them. It's not like |
@Loirooriol I'm not saying it's a quick follow-up, but that somehow or other, we need to address it. We can't just give up and say "logical background positions are not possible". And here, unlike 1282, there's not an open question about what's an appropriate syntax. |
Even if slightly less convenient, |
Note that this is not just about Sebastian |
Edits are in for css-values-4 and css-backgrounds-4 and Oriol's issue is filed as #9690 ; closing this issue. |
The
<position>
data type is defined in CSS Backgrounds 3 to only take physical values.<length>
and<percentage>
values are resolved against the top left corner of the referenced area.In CSS Backgrounds 4 the logical values
start
,end
,x-start
,x-end
,y-start
andy-end
are added to the definition.To keep the logical values consistent they should be defined in CSS Logical Properties and be changed to
block-start
,block-end
,inline-start
andinline-end
so that the syntax looks like this:I think the syntax could then even be reduced to this:
The only differences I can see is that it would allow to mix logical and physical directions like in
block-end 10px left 30px
and requires to interpret<length-percentage>
s differently, as it allows values like20% left 2em
.<length-percentage>
s would still refer to the top or left edge if no direction is given.Sebastian
The text was updated successfully, but these errors were encountered: