Skip to content

[css-logical-1] Order of inheritance vs. mapping in logical properties #3029

Open

Description

@fantasai

Example from @FremyCompany:

  <div style="margin-left: 10px; margin-inline-start: 20px; direction: rtl">
    <div style="margin-right: inherit; margin-inline-start: inherit; direction: ltr"></div>
  </div>

It's clear that margin-right inherits 20px from the computed margin-right value on the parent. What about margin-inline-start, though? Does it inherit 10px or 20px?

Activity

  1. dbaron commented on Aug 17, 2018

    @dbaron
    Member

    It might even be clearer with the following two slightly simpler examples:

    <div style="margin-left: 10px; margin-right: 20px; direction: rtl">
      <div style="margin-left: inherit /* compat requires 10px */; direction: ltr"></div>
    </div>
    <div style="margin-left: 10px; margin-right: 20px; direction: rtl">
      <div style="margin-inline-start: inherit /* 10px or 20px? */; direction: ltr"></div>
    </div>

    In other words, does inherit inherit the computed physical value from the parent (always), or does it inherit from whichever of physical or logical was specified?

    I would hope, at least, that those two examples produce the same results (respectively) as these two:

    <div style="margin-inline-end: 10px; margin-inline-start: 20px; direction: rtl">
      <div style="margin-left: inherit; direction: ltr"></div>
    </div>
    <div style="margin-inline-end: 10px; margin-inline-start: 20px; direction: rtl">
      <div style="margin-inline-start: inherit; direction: ltr"></div>
    </div>

    since the outer div always has the same computed values for all properties (the difference in that in these last two, it got those values through logical properties rather than physical ones).

  2. fantasai commented on Aug 18, 2018

    @fantasai
    CollaboratorAuthor

    Just wanted to note here that the possible solutions to #3030 depend on what happens here.

  3. fantasai commented on Aug 18, 2018

    @fantasai
    CollaboratorAuthor

    I would hope, at least, that those two examples produce the same results (respectively) as these two.

    Yes, they would have to: inheritance uses the parent’s computed value, and pairs of corresponding logical/physical properties are required to have the same computed value.

  4. Loirooriol commented on Sep 15, 2020

    @Loirooriol
    Contributor

    What about margin-inline-start, though? Does it inherit 10px or 20px?

    Chromium, WebKit and Firefox are interoperable, it inherits 10px. So if margin-inline-start resolves to margin-left, it inherits the margin-left of the parent, even if that's the margin-inline-end of the parent.

  5. added
    i18n-tracker
    on Sep 15, 2020
  6. fantasai commented on Sep 15, 2020

    @fantasai
    CollaboratorAuthor

    @Loirooriol Thanks! We should probably check with i18n that it's acceptable behavior, but as long as it is, speccing interop sounds reasonable to me.

  7. r12a commented on Sep 15, 2020

    @r12a
    Contributor

    fwiw, last Friday i had created about 100 tests for css-logical, including the various directional permutations. It's geek week now, so i may upload the tests with results this week, or it may have to wait until next week. I might be able to add a test for this scenario, too.

  8. r12a commented on Sep 30, 2020

    @r12a
    Contributor

    So the main body of tests and results is at https://w3c.github.io/i18n-tests/results/css-logical

    I didn't yet integrate the tests for inheritance into that page, because i'm not sure about the result. You can find 2 tests at

    The results are indeed interoperable across Firefox, Chrome, and Safari browsers.

    However, i wrote the assertions following the logic that seemed sensible to me: that is that the margin-inline-start for a LTR block (ie. on the left) would inherit the value for the margin on the right (ie. at the start) of a parent RTL block. Under that criterion, all the tests fail.

    It seems somewhat illogical, as it were, that what is being inherited by a logical value is not the start (ie. logical) value of the parent. It would mean that a content author has to do some mental gymnastics to decide whether or not to use inherit explicitly.

  9. added this to the TPAC-2020-08-19 milestone on Oct 16, 2020
  10. astearns commented on Oct 19, 2020

    @astearns
    Member

    @r12a would you be available for any of our remaining meetings this week to discuss this issue?

    https://wiki.csswg.org/planning/tpac-2020#schedule

  11. fantasai commented on Oct 20, 2020

    @fantasai
    CollaboratorAuthor

    So these are the two operations under considerations:

    • Blue Line: Child’s margin-inline-start maps to margin-right which then inherits from parent’s margin-right (which is the parent’s margin-inline-end). This is what browsers currently do.
    • Red Line: Child’s margin-inline-start (which is the child’s margin-right) inherits from parent’s margin-inline-start (which is matched with parent’s margin-left). This is what @r12a expects.

    Keep in mind that properties are first cascaded (all together, logical and physical mixed and mapped by writing mode, latest declaration of a conflicting set winning), and then computed (which causes each matching pair to share a single computed value).

    logical-inheritance

  12. 14 remaining items

  13. FremyCompany commented on Oct 30, 2020

    @FremyCompany
    Contributor

    My understanding is 4, the logical properties only. But this is understable since such property doesn't exist yet...

  14. Loirooriol commented on Oct 30, 2020

    @Loirooriol
    Contributor

    Well, margin already exists. When not including the non-stable logical keyword, should it only expand to the physical properties only, or should it also reset the logical ones beforehand? From @fantasai's explanation the spec seems to want the latter, but I'm not sure if this is web compatible.

  15. Loirooriol commented on Jul 26, 2025

    @Loirooriol
    Contributor

    5 years later, nobody has implemented this resolution, and I'm not sure it would even be web compatible at this point.

    Agenda+ to re-evaluate.

  16. moved this from Agenda+ to Thursday Morning in CSS WG TPAC 2025 agendaon Nov 8, 2025
  17. moved this from Thursday Morning to Friday Morning in CSS WG TPAC 2025 agendaon Nov 10, 2025
  18. css-meeting-bot commented on Nov 14, 2025

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-logical-1] Order of inheritance vs. mapping in logical properties, and agreed to the following:

    • RESOLVED: specify inheritance works on physical properties
    The full IRC log of that discussion <iank_> yeah https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=14309 looks broken on FF.
    <noamr> oriol: we resolved on this 5 years ago. when you have an inherit on a logic property, it would inherit from the same logical property, even if the physical mode is different
    <emilio> q+
    <noamr> oriol: no browser is doing this. everyone resolves logical to physical first and only then applies inheritance
    <noamr> ack kizu
    <astearns> ack kizu
    <astearns> ack fantasai
    <kbabbitt> q+
    <astearns> ack emilio
    <noamr> fantasai: I can see the argument. I also think it was the right behavior to do. the properties that this affect are not inherited property. not a lot of people do this. I am somewhat inclined to leave current resolution
    <noamr> emilio: strong disagree. it's weird that some css wide keywords you affect some properties but not others
    <noamr> emilio: in implementations conversion to physical happens before inheritence
    <noamr> emilio: I don't see this as being terribly useful
    <astearns> ack kbabbitt
    <noamr> emilio: not sure it's worth it
    <noamr> kbabbitt: agree with emilio. the resolution was sitting for 5 years. there is additional compat risk. lets spec the current behavior
    <noamr> fantasai: ok if we are going with that direction
    <noamr> q+
    <astearns> ack noamr
    <fantasai> fantasai: but disagree there's a compat risk
    <fantasai> fantasai: super unlikely to use inherit in a logical property across direction changes even if usage was 90%
    <fantasai> noamr: logical properties are complicated enough already, let's keep it simple
    <noamr> PROPOSED RESOLUTION: specify inheritance works on physical properties
    <florian> q?
    <noamr> emilio: if this affected inherited properties the inherited one would be the physical one
    <fantasai> PROPOSED: Logical properties inherit from the parent using physical correspondance
    <noamr> florian: how mad are i18n going to be on this
    <noamr> fantasai: not a big deal I think? you can also, depending on what you're doing, you *want* the physical prop
    <noamr> astearns: let's resolve and find out
    <noamr> RESOLVED: specify inheritance works on physical properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed Accepted by CSSWG Resolutioncss-logical-1i18n-tracker

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Sponsor
    SponsoredKunjungi sekarang
    Promo