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

It is unclear how directionality should be inherited into Shadow DOM #3699

Closed
smaug---- opened this issue May 21, 2018 · 140 comments · Fixed by #9796
Closed

It is unclear how directionality should be inherited into Shadow DOM #3699

smaug---- opened this issue May 21, 2018 · 140 comments · Fixed by #9796
Labels
i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@smaug----
Copy link

...or if it should be inherited at all.
Per current spec it shouldn't be inherited
https://html.spec.whatwg.org/#the-directionality
Well, the spec doesn't really define how it should work in shadow DOM.

If host has dir="rtl", should that get inherited to shadow? If shadow DOM has dir="rtl" should that get inherited to a slots assigned nodes?

@smaug----
Copy link
Author

@hayatoito

@hayatoito
Copy link
Member

We should upstream the section 6 in Shadow DOM spec to HTML Standard.
https://w3c.github.io/webcomponents/spec/shadow/#attributes

@rniwa
Copy link

rniwa commented May 22, 2018

It seems natural that the directionality of text is inherited into the shadow tree. A component can always override the directionality of the content with dir content attribute within its shadow tree.

If the entire document is in RTL, for example, then text inside components (including slotted contents) should supposedly need to be shown in RTL by default.

@rniwa
Copy link

rniwa commented May 22, 2018

Coincidentally, that's what WebKit and Chrome does: https://jsfiddle.net/ho7qhh43/

@smaug----
Copy link
Author

It seems natural that the directionality of text is inherited into the shadow tree.

This sounds reasonable, but what about inheriting directionality from slot to assigned nodes?
(jsfiddle doesn't seem to work at some can't check whether the example is testing that.)

@annevk annevk added topic: shadow Relates to shadow trees (as defined in DOM) i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels May 22, 2018
@smaug----
Copy link
Author

https://jsfiddle.net/wcvncxma/
So in Chrome directionality does seem to propagate from shadow DOM to assigned slots, but not when
dir-attribute is on slot element itself.

@r12a r12a added i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues labels May 22, 2018
@smaug----
Copy link
Author

smaug---- commented May 22, 2018

A bit modified testcase https://jsfiddle.net/88w2druw/
Looks like dir="auto" handling works in the flattened tree, at least in Chrome.

I still don't understand the case 3. Why dir on <slot> doesn't work.

@rniwa
Copy link

rniwa commented May 22, 2018

I think case 3 is simply a bug. We're probably not taking the directionality of the slot into account due to its not generating a CSS box.

@smaug----
Copy link
Author

smaug---- commented May 22, 2018

In case dir attribute is used inside shadow DOM, I assume it is inherited also to fallback content of elements, so that querySelector(All) can use :dir pseudo class the normal way?
So, dir propagates to assignedNodes of slot, and it propagates to fallback content too?
I guess same applies to the child nodes of a host. Directionality is propagated to the shadow DOM, but also to the explicit children if they aren't assigned to any slots.
Hmm, but if they are assigned, which one wins - I guess the path which goes through slot element.

And, should rtl text inside slot's fallback content affect to the ancestors even if the slot had assigned nodes?

@smaug----
Copy link
Author

https://w3c.github.io/webcomponents/spec/shadow/#attributes clearly isn't enough here.

@hayatoito
Copy link
Member

The definition of flat tree is here: https://drafts.csswg.org/css-scoping/#flattening

@kojiishi
Copy link

The dir attributes sets the CSS direction property and rendering honors the CSS direction property, so it should inherit in the same way as CSS inheritance does in all places. Otherwise we might see DOM operations such as dir=auto or querySelector to behave differently from what we render.

@smaug----
Copy link
Author

smaug---- commented May 23, 2018

querySelector doesn't follow the rendering model, I mean, it can return stuff which isn't rendered at all.

And dir=auto -handling is also unclear. Per current spec it follows DOM tree, excluding shadow DOM.

And should :dir(ltr) or :dir(rtl) work with querySelector when selecting slot's fallback content in case there are assigned nodes to the slot? If not, why? Other selectors do work.

@tabatkins
Copy link
Contributor

tabatkins commented May 23, 2018

Right; in particular, selector matching works over the tree-of-trees, not the flat tree, so having :dir pay attention to directionality inheriting thru the flat tree seems... confusing?

(I do think that inheriting it thru the flat tree makes the most sense, unfortunately.)

@kojiishi
Copy link

Ah, good point.

I don't remember details, but Aharon and a few other bidi/i18n experts preferred to inherit the dir and lang attribute when I asked them before, and there were some discussions I could find in w3c bugzilla 27222 and WICG/webcomponents#385.

If we want to revisit this, I'm not opposed to it.

@smaug----
Copy link
Author

smaug---- commented May 23, 2018

If it inherits through flattened tree, what should the directionality be for fallback content when there are assigned nodes for the slot?

This isn't about revisiting anything, but actually defining how this all should work.

@tabatkins
Copy link
Contributor

That is to say, in this example:

<x-component dir=ltr>
 <::shadow>
  <slot select=* dir=rtl>
   <span id=foo>foo</span>
  </slot>
 </::shadow>
 <span id=bar>bar</span>
</x-component>

What's the directionality of #foo and #bar? If directionality inherits thru the flat tree, then #bar inherits an rtl direction from the slot (rather than an ltr direction from the x-component). But #foo isn't in the flat tree at all, so what is it's direction?

@smaug----
Copy link
Author

And also, if there is rtl text inside #foo and slot has dir=auto, what should the directionality of #bar be?
Or if slot has name=baz and #bar doesn't have slot=baz, yet #bar has rtl text and x-component has dir=auto, should the contents of #bar affect to the directionality of the x-component.

@kojiishi
Copy link

@smaug---- dir=auto is the scenario I discussed with experts, and they wanted flat tree to compute auto-dir, from #bar in this case. But given their understanding on shadow dom isn't very high, we could try other questions or try to find other experts.

@tabatkins good point. I don't know the answer from the top of my head, but does the directionality of #foo matter if it's not going to be rendered at all?

@smaug----
Copy link
Author

directionality of #foo matters because if affects how querySelector(:dir(...)) works. It can't be left undefined.

@kojiishi
Copy link

:dir() matches to elements with the 'dir' attribute, not the inherited value, no?

@kojiishi
Copy link

nvm, I was wrong. ^

@kojiishi
Copy link

Allow me to confirm what we're discussing. The original topic was about whether to inherit or not, I still prefer to inherit, but can't read whether we have consensus or not. Do we, or does it depend on another topic how it applies/inherits to fallback contents that are not rendered?

For the fallback contents that are not rendered, I don't have opinion. Anyone mind to suggest?

@tabatkins
Copy link
Contributor

The directionality of fallback contents is one problem. The larger problem is that selector matching is defined over the tree-of-trees, not the flat tree, but :dir(), to continue to remain useful, needs to be based on the flat-tree directionality inheritance. (Selectors doesn't strictly define how :dir() matches; it just says that the document language can take various things into account to figure out what the directionality should be.)

@kojiishi
Copy link

I see, thank you, understood the topic. That part is probably about the dir attribute section defines to inherit from:

the element's parent element

so if we're in consensus to do this in flat-tree, we can define this more clearly, like saying "parent in flat-tree, but for elements that are not in flat-tree, inherit from parent in tree-of-trees"?

@tabatkins
Copy link
Contributor

That doesn't solve the larger problem I just outlined. Again, Selectors are defined to match on the tree-of-trees, before we construct the flat tree, so if directionality is defined to inherit over the flat tree, :dir() can't match based on the inherited directionality. We'll need to define what it matches on - in other words, in my previous example, does #bar match :dir(ltr) or :dir(rtl), and whichever answer you give, why does it match that (without referencing the flat tree)?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue 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
dbaron added a commit to dbaron/html that referenced this issue Oct 25, 2023
The rules for finding the language of a node were made somewhat more
formal in 11dc4c7 (PR whatwg#9796,
fixing whatwg#3699).  Both before and after that change they considered the
lang attribute in the XML namespace, and the lang attribute in no
namespace on HTML elements.  However, the SVG spec at
https://www.w3.org/TR/2018/CR-SVG2-20181004/struct.html#LangSpaceAttrs
has very similar wording to the HTML spec prior to that edit, and also
defined a lang attribute on SVG elements.

This updates the language of a node algorithm in HTML to consider SVG
elements as well, since implementing it as written (without this change)
breaks the lang attribute in SVG.
aarongable pushed a commit to chromium/chromium that referenced this issue 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 issue 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 issue 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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 26, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

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

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Oct 27, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

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

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 30, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

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

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315

UltraBlame original commit: 28cd492bf06128adefbd727f510e3773c4c531ab
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 30, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

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

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315

UltraBlame original commit: 28cd492bf06128adefbd727f510e3773c4c531ab
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 30, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

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

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315

UltraBlame original commit: 28cd492bf06128adefbd727f510e3773c4c531ab
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 7, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
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}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 7, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

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}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Nov 7, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
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}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Nov 7, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

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}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
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 <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

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 <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.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 <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
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 <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

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 <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.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 <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
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 <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

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 <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.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 <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 2023
…cestors.

This change treats a <slot> element as being a strong character, of its
resolved directionality, when resolving dir=auto on its shadow tree
ancestor.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag
because we're hoping to ship that feature soon and it makes sense to
ship related changes to direction handling all at once rather than
piecemeal.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9166
whatwg/html#9452
whatwg/html#9554

This fixes the failures of:
external/wpt/shadow-dom/directionality/dir-shadow-30.html
external/wpt/shadow-dom/directionality/dir-shadow-34.html
in the still-unlanded WPT PR at
web-platform-tests#29820

This also changes the existing WPT
html/dom/elements/global-attributes/dir-slots-directionality.tentative.html
in the following ways:
 * split the test into separate test() functions to get separate results
 * add a sixth test testing <slot dir=auto></slot>
 * add tests of the :dir() selector for each test (where Chromium fails
   this test for test 1)
 * change the expected result of the fourth test to match this code
   change and the proposed specification

Bug: 576815
Change-Id: I83551e9bc5807109c5318bace486cfc93fc25bbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800366
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1186743}
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 2023
…or dir=auto

This rewrites significant aspects of inheritance of HTML direction
(which affects the unshipped :dir() selector and also the shipped
dirname attribute), including its invalidation, to match current spec
proposals regarding how the inheritance operates on Shadow DOM, and to
improve invalidation in response to dynamic changes.  Inheritance of
direction now operates on the node tree, except that shadow roots and
slots both inherit from the shadow host.  It previously operated on the
flat tree.  This change should not affect the computed values of the CSS
direction property, since the HTML direction is only mapped to CSS
direction on elements where the HTML direction is not inherited.

This also restructures the shadow tree-related invalidation code for
dir=auto to match the changes implemented in
https://crrev.com/26b1b30268b7af4f0e44f298c10338a65e656f40 , which made
dir=auto operate on the node tree, and the additional behavior
implemented in
https://crrev.com/6abc9cbde67c0700be364c7aab86cb29188c7d5d that
implemented special rules (looking at slotted children) for <slot
dir=auto>.  Certain text-like form controls also have similar special
rules in which they look at their value.  This change can affect the
computed values of the CSS direction property when the direction
computed by dir=auto is different.

The invalidation code for these two distinct things was (in the old
code) too tied together to cleanly separate these changes.

The reason these changes are the next step of work is because they
change (when CSSPseudoDirEnabled) the one caller that passed a
stay_within parameter to CalculateAndAdjustAutoDirectionality that is
different from this; this enables further (smaller) refactoring that I
believe will be needed to fix the failure of
external/wpt/shadow-dom/directionality/dir-shadow-41.html in the
still-unlanded WPT PR at
web-platform-tests#29820 .  I believe this
existing using of stay_within does not make sense; it doesn't make sense
to try to partially traverse the descendants of a dir=auto element with
a different termination point.  The traversal of a dir=auto element
should always start at its start and should terminate at the first
strong character or the end of the contents that should influence the
dir=auto.  (There are cases where the interaction of the stay_within and
the use of NodeTraversal/FlatTreeTraversal meant that the stay_within
parameter was missed entirely and the tree was searched beyond the
contents that should be; this is a step towards the refactoring needed
to fix that.)

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9166
whatwg/html#9452
whatwg/html#9554

Bug: 576815
Change-Id: Ic31a3f801f64042a3b4979afdc4e141f45e3b228
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4811757
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1199647}
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
web-platform-tests#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805163
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202893}
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 2023
…ality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

Bug: 576815
Change-Id: I57323aeda8850f382756cd36b3717d34e8911f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4908695
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204886}
annevk pushed a commit that referenced this issue Jan 24, 2024
As well as some of the corresponding changes to its directionality and language.

This reverts recent changes to the rendering section for the slot
element that I made recently in 1dc4c7557f5a4c879c1ce65b9cb59b91310bbf5
(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.)
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jun 1, 2024
Automatic update from web-platform-tests
Fix an element directionality

This CL fixes the bugs raised up during the discussion of slots
at whatwg/html#3699.
 - Resolve the light tree element's directionality in the light tree
   and do not walk into the shadow tree for encapsulation.
 - Resolve the element's directionality when there is not a slotted
   node.

Bug: 1236384
Change-Id: Id22aa3e5b624a2e3234c645e198749360f3a050d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3066807
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#909242}

--

wpt-commits: 64bba2c43109cc8a3173ac45d4216fa65624d0bc
wpt-pr: 29889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. topic: shadow Relates to shadow trees (as defined in DOM)