Skip to content
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

Revert recent changes to rendering of <slot>, and some of the corresponding changes to its directionality and language #9880

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

dbaron
Copy link
Member

@dbaron dbaron commented Oct 25, 2023

This reverts recent changes to the rendering section for the slot element that I made recently in 11dc4c7 (PR #9796, fixing #3699). These changes had specified that all slot elements, even those without a dir attribute, specify the direction and unicode-bidi properties.

When I attempted to implement these changes, I discovered that they broke a significant number of web-platform-tests, due to a pattern that makes me suspect they would pose a compatibility problem. In particular, specifying the CSS direction property for all slot elements breaks inheritance of CSS direction into slotted elements, including those in user-agent shadow DOM. (This makes a clearly visible change when elements are implemented in terms of user-agent shadow DOM, which probably is not intended.)

While I realize that the recommended practice is to specify the HTML dir attribute rather than the CSS direction property, I believe the CSS direction property is used enough that this is not acceptable. (https://chromestatus.com/metrics/css/timeline/popularity/3 says the property is used on around 40% of page loads. While the number of interesting uses is probably substantially lower, it's also probably still significant.)

To match this revert, this also removes the special rule that slot elements inherit their directionality from the shadow host.

(See WHATWG Working Mode: Changes for more details.)


/dom.html ( diff )
/rendering.html ( diff )

This reverts recent changes to the rendering section for the slot
element that I made recently in 1dc4c7557f5a4c879c1ce65b9cb59b91310bbf5
(PR whatwg#9796, fixing whatwg#3699).  These changes had specified that all slot
elements, even those without a dir attribute, specify the direction and
unicode-bidi properties.

When I attempted to implement these changes, I discovered that they
broke a significant number of web-platform-tests, due to a pattern that
makes me suspect they would pose a compatibility problem.  In
particular, specifying the CSS direction property for all slot elements
breaks inheritance of CSS direction into slotted elements, including
those in user-agent shadow DOM.  (This makes a clearly visible change
when elements are implemented in terms of user-agent shadow DOM, which
probably is not intended.)

While I realize that the recommended practice is to specify the HTML dir
attribute rather than the CSS direction property, I believe the CSS
direction property is used enough that this is not acceptable.
(https://chromestatus.com/metrics/css/timeline/popularity/3 says the
property is used on around 40% of page loads.  While the number of
interesting uses is probably substantially lower, it's also probably
still significant.)
@dbaron
Copy link
Member Author

dbaron commented Oct 25, 2023

I'm interested in feedback from @fantasai on this, since:

  • I'm not entirely sure of the motivation for originally proposing this in It is unclear how directionality should be inherited into Shadow DOM #3699 (comment)
  • I'm not entirely sure what the right set of changes to revert is, i.e., which set of changes that are closely tied together. I chose to revert both the unicode-bidi and direction changes, although reverting only direction is also (I think) plausible. And it's possible these rules were closely connected to something else that should also be reverted.

For what it's worth, see:

the list of WPT tests that were broken by the change
  • html/dom/elements/global-attributes/dir-shadow-27.html
  • html/dom/elements/global-attributes/dir-shadow-28.html
  • html/dom/elements/global-attributes/dir-shadow-35.html
  • html/dom/elements/global-attributes/dir-shadow-37.html
  • html/semantics/forms/the-selectlist-element/selectlist-rtl.tentative.html
the list of Chromium-internal web tests that were broken by the change
  • fast/forms/select-popup/popup-menu-appearance-rtl-default.html
  • fast/forms/select-popup/popup-menu-appearance-rtl.html
  • fast/forms/select/menulist-appearance-rtl.html
  • fast/forms/select/select-writing-direction-natural.html
  • html/details_summary/details-writing-mode-align-center.html
  • html/details_summary/details-writing-mode-align-left.html
  • html/details_summary/details-writing-mode-align-right.html
  • html/details_summary/details-writing-mode.html
  • virtual/text-antialias/international/bidi-listbox-atsui.html
  • virtual/text-antialias/international/bidi-listbox.html

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
@fantasai
Copy link
Contributor

fantasai commented Oct 25, 2023

I'm not entirely sure of the motivation for originally proposing this

The slot:dir() rules are there to implement the behavior that the directionality of a slot element is taken from the shadow root, not from the slot's parent. See #3699 (comment) This is in order to preserve (by default) the flow of directionality through the light DOM, which would otherwise be interrupted by directionality settings in the shadow DOM.

aarongable pushed a commit to chromium/chromium that referenced this pull request Oct 25, 2023
This reverts commit 198d41c.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdr@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215009}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdr@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215009}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdr@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215009}
@dbaron
Copy link
Member Author

dbaron commented Oct 25, 2023

So if we're going to remove those rules, should we just remove what I've removed here, remove less (i.e., leave the unicode-bidi), or change more to accomodate the change?

I think this change just breaks uses of the CSS direction property too much to be acceptable compat risk -- it makes CSS direction stop inheriting into any subtrees that are inside of shadow DOM (for example, the contents of many form controls or the contents of a details element). I understand that you think authors shouldn't use direction directly but should instead use the dir attribute, but given metrics showing that 40% of page loads invoke parsing of the CSS direction property, I don't think this is worth trying.

Also, I checked what that 40% usage number comes from and it (a) doesn't include UA sheets and (b) doesn't include the mapping of HTML presentational attributes. However, I think it probably does count the two internal uses of CSS direction that involve (1) VTT cue boxes and (2) date/time form controls that are in an RTL context.

@fantasai
Copy link
Contributor

So if we're going to remove those rules, should we just remove what I've removed here, remove less (i.e., leave the unicode-bidi), or change more to accommodate the change?

Leaving unicode-bidi is fine, but you would also need to remove the fact that slot inherits its directionality from the shadow root, because if you don't then you'll end up with elements whose HTML directionality does not correspond to their CSS direction.

The downside to removing this is that any use of direction or dir in a shadow DOM on elements that are ancestors of a slot element can scramble the light DOM contents inside the slot. So I think you should think about whether this is appropriate to revert, or if there is some alternative change that would be better.

If your primary concern is UA shadow DOM, for example, we could unset the direction property on UA shadow DOM slot elements only, with the understanding that UAs will be careful not to use dir or direction on ancestors of their slot elements.

@dbaron
Copy link
Member Author

dbaron commented Oct 26, 2023

I don't think my primary concern is UA shadow DOM -- I think it's just that UA shadow DOM is much more visible in terms of what I see in web-platform-tests and in Chrome's Web tests. I think it's an issue for any uses of shadow DOM combined with the CSS direction property.

I'm inclined to remove the use of unicode-bidi since it's a pretty weird UA style, since it only kicks in after an explicit change of display from the default display: contents to display: inline, which I think will likely be rare.

So it sounds like the additional change I should make here is to remove slot inheriting direction from the shadow root.

I'm having trouble thinking of good use cases for direction or dir in a shadow DOM on ancestors of a slot; it seems like the norm there should be to allow direction to inherit through.

@dbaron
Copy link
Member Author

dbaron commented Oct 26, 2023

So in terms of reverting additional pieces:

  • I think it's clear that I should revert the part where slot inherits directionality from the shadow root
  • I think I probably should not revert the rule for auto-directionality of a slot element itself that looks at the slotted content
  • I'm less sure what to do about the rule that auto-directionality for the ancestor of a slot treats the slot as first strong. Does it still make sense to keep that?

@dbaron
Copy link
Member Author

dbaron commented Oct 26, 2023

Er, regarding the third point, I think I have to change the rule that dir=auto on the ancestor of the slot treats the slot as first strong in some way, since given the first two pieces the direction of the slot now inherits from the dir=auto. I think there are a few options:

  • treat the slot as first strong based on the direction of the shadow host (same behavior, but described differently)
  • treat the slot as empty
  • descend into the slotted content (may be difficult)

For now I think I'm going to prepare a change that does the first, but I'm certainly open to opinions on this.

@dbaron dbaron changed the title Revert recent changes to rendering of <slot> Revert recent changes to rendering of <slot>, and some of the corresponding changes to its directionality Oct 26, 2023
@fantasai
Copy link
Contributor

CC @rniwa @jfkthame @r12a @smaug----

@dbaron dbaron changed the title Revert recent changes to rendering of <slot>, and some of the corresponding changes to its directionality Revert recent changes to rendering of <slot>, and some of the corresponding changes to its directionality and language Oct 27, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 27, 2023
…lot> elements.

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
@dbaron
Copy link
Member Author

dbaron commented Oct 27, 2023

I also added the change to language inheritance, to keep language inheritance matching directionality inheritance.

aarongable pushed a commit to chromium/chromium that referenced this pull request Oct 27, 2023
…lot> elements.

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 27, 2023
…lot> elements.

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}
@dbaron
Copy link
Member Author

dbaron commented Oct 30, 2023

FYI, what's in the current state of this PR is what I'm currently planning will ship in Chrome 120 (which branches today). That's because my plan is to ship the :dir() pseudo and the changes in #9554 and #9796 in M120, and (as described above) I didn't think this one piece of the changes in #9796 was something we could ship, and I wanted to omit a coherent piece of it (reflected in the current state of this PR) and ship the rest.

This is (within reason) changeable in the future if the changes are worthwhile, but I wanted to add a note here so that others knew that it's currently on track to ship.

DanielRyanSmith pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 30, 2023
…lot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}

Co-authored-by: L. David Baron <dbaron@chromium.org>
Copy link
Contributor

@sideshowbarker sideshowbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ on the lang-related part of this at https://github.com/web-platform-tests/wpt/pull/42811/files#diff-3e68420ba9732782c4a09ec7119cd7556e9d1aedef5f2bc98f8d7ef92322a4ab — based on having had written (yesterday) and tested a WebKit patch which implemented that lang part of the spec change that’s being reverted in this PR…

@smaug----
Copy link
Collaborator

I'm still trying to understand all the ways this would break "This is in order to preserve (by default) the flow of directionality through the light DOM, which would otherwise be interrupted by directionality settings in the shadow DOM".

Not saying whether the change is good or bad, just trying to think of the behavior.

vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this pull request Nov 15, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}

Co-authored-by: L. David Baron <dbaron@chromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 16, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 741c58ae49f75723489b635e662f1fa8caf9a341
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 16, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 741c58ae49f75723489b635e662f1fa8caf9a341
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 16, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 741c58ae49f75723489b635e662f1fa8caf9a341
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 20, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}

Co-authored-by: L. David Baron <dbaron@chromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Nov 20, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216286}

Co-authored-by: L. David Baron <dbaron@chromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 21, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 7b03de6bdb3af4238f001a4b2d9016c2add83044
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 21, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 7b03de6bdb3af4238f001a4b2d9016c2add83044
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 21, 2023
…direction and language for <slot> elements., a=testonly

Automatic update from web-platform-tests
Revert recent changes to inheritance of direction and language for <slot> elements. (#42811)

This changes the way <slot> elements inherit the HTML concepts of
direction and language to inherit from their parent, rather than from
their shadow root's host.

This matches the changes that I'm proposing in:
whatwg/html#9880

These changes are all behind flags that are slated to ship in M120:
CSSPseudoDir for the direction changes and HTMLLangNewInheritance for
the language changes.

Bug: 576815, 1490711
Change-Id: I152d8e21e24e77c9359744019b3ab875c2a21727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4984312
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1216286}

Co-authored-by: L. David Baron <dbaronchromium.org>
--

wpt-commits: e873a33f5a8564beb3864cb779e0c774aa4816c7
wpt-pr: 42811

UltraBlame original commit: 7b03de6bdb3af4238f001a4b2d9016c2add83044
@smaug----
Copy link
Collaborator

Do we have any data about dir or direction usage in shadow DOM currently?

@dbaron
Copy link
Member Author

dbaron commented Dec 13, 2023

I don't.

Though my concern here (that led me to want to revert this) is that an element that uses shadow DOM would break the result of setting CSS direction on an ancestor of that element.

@annevk
Copy link
Member

annevk commented Jan 15, 2024

It seems to me you might well specify dir (or lang) on an ancestor of a slot, just to denote the direction and language for all content that's inside the shadow tree (similar to how you might use <html> today). I wonder if recommending against it will be sufficient.

@emilio
Copy link
Contributor

emilio commented Jan 15, 2024

@dbaron Is it an option to just remove the slot UA styles to always set direction / unicode-bidi? If not, why not?

That'd keep the right DOM / :dir() state, while not breaking the "author set direction explicitly in the CSS" case.

I might have misunderstood something tho.

@emilio
Copy link
Contributor

emilio commented Jan 15, 2024

I guess that'd end up with slot:dir(ltr) having rtl direction without css changes or vice versa which can be pretty weird... So yeah, maybe this is ok.

@dbaron
Copy link
Member Author

dbaron commented Jan 15, 2024

Regarding @annevk's comment:

It seems to me you might well specify dir (or lang) on an ancestor of a slot, just to denote the direction and language for all content that's inside the shadow tree (similar to how you might use <html> today). I wonder if recommending against it will be sufficient.

My intuition is that somebody just trying this would likely stop and think "I wonder if this is also going to affect the light DOM that's slotted into the slots". That said, some people with that thought might consult documentation (in which case recommending against it would help) and some may instead answer the question by testing (where the thing they use to test might be either HTML directionality or CSS directionality, and where documentation wouldn't help).

(I also don't think there's a perfect answer here, but I think the approach that I recently landed into the spec that I'm proposing to revert here has too much risk of both current and future compatibility problems. By future compatibility problems, I mean that it means that we're introducing a new compatibility risk that could be an obstacle to converting any existing element to being implemented in terms of Shadow DOM.)

Regarding @emilio's comment -- I think it sounds like Emilio answered his own question, but let me know if there's something you still want me (or someone else) to answer.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's fair. I don't really see a good alternative either.

I do think new implementation bugs are needed as the existing ones are resolved.

@dbaron
Copy link
Member Author

dbaron commented Jan 23, 2024

I filed new implementation bugs for WebKit and Gecko and updated the initial comment. (That was an oversight in #9796!)

Copy link
Collaborator

@smaug---- smaug---- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can live with this, although this feels a bit unfortunate

@annevk annevk merged commit 0c6f327 into whatwg:main Jan 24, 2024
2 checks passed
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 24, 2024
These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
aarongable pushed a commit to chromium/chromium that referenced this pull request Jan 24, 2024
These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 24, 2024
These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 25, 2024
These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 29, 2024
…on behavior of <slot> element., a=testonly

Automatic update from web-platform-tests
Add tests for direction and bidi isolation behavior of <slot> element.

These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}

--

wpt-commits: 41bbcfcc813d99401ca0cacfa392c87d6f18ffca
wpt-pr: 44178
ErichDonGubler pushed a commit to ErichDonGubler/firefox that referenced this pull request Jan 30, 2024
…on behavior of <slot> element., a=testonly

Automatic update from web-platform-tests
Add tests for direction and bidi isolation behavior of <slot> element.

These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}

--

wpt-commits: 41bbcfcc813d99401ca0cacfa392c87d6f18ffca
wpt-pr: 44178
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Feb 1, 2024
…on behavior of <slot> element., a=testonly

Automatic update from web-platform-tests
Add tests for direction and bidi isolation behavior of <slot> element.

These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhanggchromium.org>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1251783}

--

wpt-commits: 41bbcfcc813d99401ca0cacfa392c87d6f18ffca
wpt-pr: 44178

UltraBlame original commit: 6dc79c28daa8bf6d48215692303e1097aa118baa
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Feb 1, 2024
…on behavior of <slot> element., a=testonly

Automatic update from web-platform-tests
Add tests for direction and bidi isolation behavior of <slot> element.

These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhanggchromium.org>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1251783}

--

wpt-commits: 41bbcfcc813d99401ca0cacfa392c87d6f18ffca
wpt-pr: 44178

UltraBlame original commit: 6dc79c28daa8bf6d48215692303e1097aa118baa
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 23, 2024
These tests are based on the tests previously in
https://crrev.com/c/4800075 and https://crrev.com/c/4973701, but are
revised to reflect that the HTML spec changes that those changes were
implementing have been reverted in
whatwg/html#9880

Bug: 576815
Change-Id: Id4536cb39691c2d234113f891f96d7100c7eeea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233352
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251783}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants