-
Notifications
You must be signed in to change notification settings - Fork 671
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-logical] Flow-relative syntax for margin
-like shorthands
#1282
Comments
I agree with the current proposal, a keyword in front of the values. I personally like A couple of points:
|
|
@MurakamiShinyu — I see where you are going with this, but it could potentially become often confused with I think with a keyword such as
|
I admit it's a crazy idea: 'margins' stands for "margin's writing-mode relative shorthand". But there is one advantage: 'margins' is easier to type than 'margin-relative' or 'margin: relative ...'. My concern is that people may feel troublesome to type a lot of 'relative' when css-logical-props becomes widely available. |
I like the idea of !keyword that could be added to any 4-value clockwise shorthand (and their 3-value, 2-value, and 1-value versions). How about just an unadorned
is equivalent to
Adding the |
Why not go the same route as for box-sizing? So something like Then when the support gets common you could just do:
|
Having a I totally agree with @chharvey's comment that Sebastian |
If I got the ticket right (because the opening post doesn't really explain): I think I have already answered via twitter... but I am suggesting transpose again. |
@cork I do like your idea of
One upside would be that you wouldn't have to change the Alas, a recent change of the spec indicates a different order when relative values are used.
So in the example above, by adding Another downside: you would have to have corresponding "mode" properties for the following, which could be a bit much:
|
I suspect I like the I'm concerned though, that this might lead to new CSS properties being defined as physical-first and require |
I like the idea of #1279:
e.g.
|
I have to raise my voice and say that short symbolic like a punctuation ( I'd favour extra logical properties. Aka That is a very clear and easy interface for authors and there is no clash between old properties and new properties. Authors can also use margin and margin-relative independent of each other and thus are not breaking css parsing of older browsers! So I really like @fantasai initial proposal. |
Wow, okay! Here's some responses:
|
Agree with @fantasai. Now I feel original How about
and CSS already has abbreviations in some keywords, e.g., "rl" (for "right to left direction") in |
Sorry; typo in commit message. :/ |
If the keyword route is decided upon, can the syntax allow it to be at the beginning or end of the declaration? Inspired by So for
|
Weird. My comment was posted to the wrong page |
I really don't think we should have If it is to be typed a lot (and really, that is the hope, that authors are considering bi-di and writing mode all the time), then it needs to be very short. I would say no more than 2-3 letters long. I still prefer an unadorned |
margin
-like shorthandsmargin
-like shorthands
I know there are multiple arguments against having a separate property that controls interpretations of shorthands for reasons like implementation difficulty or "action at a distance", but isn't that akin to how I'd imagine anyone who wants to use logical features would be "all in", not needing to set individual "modes" and wanting something like |
@fantasai wrote:
Even if we expect this to become the default mode of assignment for many authors, I would still prefer clarity & readability to typing efficiency, because the latter can be mitigated by code completion and code snippets in authoring tools, and IMHO shouldn't be a major concern (comparing with readability & less surprise for authors who are not familiar with flow-relative properties) when designing a language like CSS. |
I agree strongly with @bradkemper’s comment: this needs to be generic enough that it doesn't get confused with property-specific value spaces, and it also needs to be convenient enough that authors using flow-relative syntaxes are not at a significant ergonomic disadvantage compared to authors using physical syntaxes. Another option would be to have a longer per-declaration !keyword (for clarity) but also a higher-level syntax similar to |
A third option would be to have some other not-currently-used single punctuation character somewhere in the declaration, to indicate flow-relative mapping, e.g.
This is convenient to type and safe for out-of-context quoting, at the cost of being more obscure. |
How would this work? Would there be a 4th argument? element.style.setProperty("margin", "1px 2px 3px 4px"); // non-important, physical
element.style.setProperty("margin", "1px 2px 3px 4px", "important"); // important, physical
element.style.setProperty("margin", "1px 2px 3px 4px", "", "logical"); // non-important, logical
element.style.setProperty("margin", "1px 2px 3px 4px", "important", "logical"); // important, logical Or conflate all flags into the 3rd argument like What about reading? I bet most scripts will just use What about computed styles? I don't think we want to track if the value comes from a logical or physical declaration, just like we don't track the priority (computed properties are considered non-important). So should they be considered physical or logical? From the point of view of CSSOM, using different properties seems way less problematic. |
The CSS Working Group just discussed The full IRC log of that discussion<TabAtkins> addison: This one we discussed last year at TPAC<TabAtkins> addison: called flow-relative syntax for margin-like shorthands <TabAtkins> addison: But really it's about providing support for directionality by changing left/right to start/end in various properties <TabAtkins> addison: And allowing margin-like shorthands (the 4-direction props) to follow that <TabAtkins> addison: We've been working with some CSSWG members on the steps necessary to do this in a generic fashion across CSS <TabAtkins> addison: There've been some action items outstanding, I think florian has one to enumerate the various props <TabAtkins> addison: So this is a check-in to see how progress is going, see if we can encourage progress <TabAtkins> addison: And make sure the larger WG remains aware. <florian> q? <TabAtkins> florian: Sorry to report I haven't progressed my Action Item <TabAtkins> florian: But now that I'm not a board<->AB laiason I ahve a lot more time and plan to make progress. Sorry for not doing it so far. <TabAtkins> addison: The more global thing - we've been having monthly calls, with Floriana nd Elika repping CSS, and others of us repping i18n. <TabAtkins> addison: It's been productive (if inconveniently timed) call, and we've been handling issues <TabAtkins> addison: If anyone wants to participate, please ping me to get notified. <TabAtkins> addison: We welcome participation. <TabAtkins> astearns: Besides the florian AI, any other progress on this issue? <TabAtkins> addison: Any other concerns? Otherwise we can move on. |
Hi, I just came around to this thread from a link in the MDN reference on the logical shorthands. I would be very happy to see 4-value logical properties to be a thing too. After quickly skimming through this interesting discussion, I have one quite elementary question: has anybody proposed a property suffix like Obviously I have never been involved in or conducted any deep scrutiny, but wondering if such a naming has whatever kind of known pros and cons. |
It has been proposed to add logical shorthands, with names like |
@Loirooriol Are you sure that the current verdict on the distinct property approach is "2nd class citizens regardless of name"? What I got from the latest log is that "let's try to have a name that doesn't look 2nd class citizen". (Otherwise, it'd sound like |
…on test off from css/css-logical/animation-001.html as a dedicated tentative test https://bugs.webkit.org/show_bug.cgi?id=278910 rdar://135006627 Reviewed by NOBODY (OOPS!). Given the `logical` keyword for the `margin` shorthand, and other relative shorthands, is not stable yet, as discussed in w3c/csswg-drafts#1282, we split off the test in `css/css-logical/animation-001.html` that relies on this feature and make a new test file marked `.tentative`. * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animations/logical-shorthand-relative-prioritization-by-number-of-components.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animations/logical-shorthand-relative-prioritization-by-number-of-components.tentative.html: Added.
…on test off from css/css-logical/animation-001.html as a dedicated tentative test https://bugs.webkit.org/show_bug.cgi?id=278910 rdar://135006627 Reviewed by Anne van Kesteren. Given the `logical` keyword for the `margin` shorthand, and other relative shorthands, is not stable yet, as discussed in w3c/csswg-drafts#1282, we split off the test in `css/css-logical/animation-001.html` that relies on this feature and make a new test file marked `.tentative`. * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animations/logical-shorthand-relative-prioritization-by-number-of-components.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animations/logical-shorthand-relative-prioritization-by-number-of-components.tentative.html: Added. Canonical link: https://commits.webkit.org/282961@main
The CSS Working Group just discussed The full IRC log of that discussion<TabAtkins> florian: my memory of where we're stuck is we had a few proposals for syntax to opt into the flipping, and we were planning to evaluate those on the basis of triaging all properties as being "physical/logical is irrelevant" or "matters, but can go either way". that action has been on me for a long time, and still is<TabAtkins> florian: I *think* that's where we're stuck <TabAtkins> addison: I think that's the next. can we get cycles, and will that resolve this issue. <TabAtkins> florian: I think that step is necessary, whether it's sufficient is fuzzier <TabAtkins> florian: step doesn't *have* to be done by me. think it's been on me for a year or more <TabAtkins> addison: at least July '23, yeah <TabAtkins> astearns: can you outline what the task will detail? <TabAtkins> astearns: saying "here's what someone needs to do, i'll get to it when I can, but if anyone wants to help here's the steps" <TabAtkins> florian: I can try <TabAtkins> astearns: any other suggestions for kicking it off? <TabAtkins> addison: I think that's core |
CSS currently assigns the values in the margin/padding/border shorthand to their physical longhands, i.e.
is equivalent to
I'm pretty sure we want some equivalent syntax for assigning into the logical longhands instead, but what should that be?
The current proposal is to put a keyword in front of the 4 values, like
Another possibility is to use a !keyword:
or to create a new property in its place:
or use some entirely as-yet-unused symbol or syntax.
And of course the exact keyword, if one is used, is up for debate as well; shorter would be better. People will be drawing up entire style sheets that use almost exclusively flow-relative properties, so this needs to be designed for comfort under frequent use.
Ideas welcome~
The text was updated successfully, but these errors were encountered: