You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
agenda+To be discussed at a triage meetingtopic: focusFocus, sequential focus navigation, tabindex, autofocus and inerttopic: shadowRelates to shadow trees (as defined in DOM)
See discussion in #7079. Including the effects of that PR, focusing and unfocusing (e.g. via focus() and blur()) a delegatesFocus shadow host uses the flat tree: given
I find delegating focus to stuff outside the shadow tree a bit weird, because you call focus(), the focus changes, but activeElement is not the host, and the host doesn't match :focus either.
I'm not sure why delegatesFocus was specified to look for focusable elements using the flat tree rather than the shadow-including tree of the shadow root, seems really weird.
which I tend to agree with. Recall that the main use cases for delegatesFocus are things like <input type="date"> where you want to focus things in the shadow DOM, not the light DOM.
The alternate proposal is that delegatesFocus should use the shadow tree. In this case, in the above example, the <div tabindex=0>In shadow tree</div> would get focus delegated to it, and document.activeElement would be the shadow host, and :focus would match the host.
Reacted by Darien Maillet Valentine and Benny Powers
@mfreed7, do you find the arguments here convincing? I think we should probably use the shadow tree instead of the flat tree, for both blur() and focus(); we could try to find some web developers to ask, but based on the known use cases for delegatesFocus I think shadow tree is correct.
Yeah, I do find them a bit convincing. But as I mentioned, I'd feel better getting some input from developers that use delegatesFocus. Have we heard of any use cases that involve focusing slotted light dom content? I would hate to resolve this in favor of using the shadow root's shadow-including subtree, change browser behavior, and then find out what the critical use case was for instead using the flat tree.
Absent any such developer input, I suppose I could be convinced by the above arguments. I do think it sounds a bit funny to focus light dom slotted content. So if we're in a hurry to resolve this one way or the other, I'm ok changing Chromium's focus() to not use the flat tree.
Trying to get developer feedback seems fair. I think you're more connected to the web components developer-using community than I am these days, so could you take point on that?
I don't think we're in a big hurry, but it does stand out as a wart. And I got the impression it was hurting Firefox's progress on shipping some stuff?
I'm my limited experience using WCs, this change seems to make sense and is in line with other isolation models. If I want to focus/blur some slotted content I should be able to do that regardless of the shadow DOM by keeping a reference to the slotted light DOM. I see delegatesFocus as part of the API into the WC, not the slotted content.
This changes makes sense to me. I've only dabbled with delegatesFocus, due to lack of broad browser support, but i would have been surprised to discover that it can delegate to slotted content. I specifically want this to delegate to my shadow elements, that's the benefit of the feature imo
I'd feel better getting some input from developers that use delegatesFocus
Just one data point but I have used it a fair amount and was under the impression that the proposed behavior was already how it worked. I either got lucky and just never had slots prior to the first in-shadow focusable or possibly just learned I have some bugs I don't know about!
Seems there's no great compelling argument for the current behavior then... I'm happy to update the WPTs and Gecko. @domenic can / do you want to fix the spec? It'd probably take me a bit more than you, but if you're busy I can try :-)
agenda+To be discussed at a triage meetingtopic: focusFocus, sequential focus navigation, tabindex, autofocus and inerttopic: shadowRelates to shadow trees (as defined in DOM)
Activity
domenic commentedon Oct 15, 2021
@mfreed7, do you find the arguments here convincing? I think we should probably use the shadow tree instead of the flat tree, for both
blur()andfocus(); we could try to find some web developers to ask, but based on the known use cases fordelegatesFocusI think shadow tree is correct.mfreed7 commentedon Oct 19, 2021
Yeah, I do find them a bit convincing. But as I mentioned, I'd feel better getting some input from developers that use
delegatesFocus. Have we heard of any use cases that involve focusing slotted light dom content? I would hate to resolve this in favor of using the shadow root's shadow-including subtree, change browser behavior, and then find out what the critical use case was for instead using the flat tree.Absent any such developer input, I suppose I could be convinced by the above arguments. I do think it sounds a bit funny to focus light dom slotted content. So if we're in a hurry to resolve this one way or the other, I'm ok changing Chromium's
focus()to not use the flat tree.emilio commentedon Oct 19, 2021
I'm not on a massive rush other than "the longer we wait to change this, the easier it is for people to depend on it"
domenic commentedon Oct 20, 2021
Trying to get developer feedback seems fair. I think you're more connected to the web components developer-using community than I am these days, so could you take point on that?
Edit: I also tweeted, to do my part :) https://twitter.com/domenic/status/1450919182850211849
I don't think we're in a big hurry, but it does stand out as a wart. And I got the impression it was hurting Firefox's progress on shipping some stuff?
nemzes commentedon Oct 20, 2021
I'm my limited experience using WCs, this change seems to make sense and is in line with other isolation models. If I want to focus/blur some slotted content I should be able to do that regardless of the shadow DOM by keeping a reference to the slotted light DOM. I see
delegatesFocusas part of the API into the WC, not the slotted content.WickyNilliams commentedon Oct 21, 2021
This changes makes sense to me. I've only dabbled with
delegatesFocus, due to lack of broad browser support, but i would have been surprised to discover that it can delegate to slotted content. I specifically want this to delegate to my shadow elements, that's the benefit of the feature imobathos commentedon Oct 21, 2021
Just one data point but I have used it a fair amount and was under the impression that the proposed behavior was already how it worked. I either got lucky and just never had slots prior to the first in-shadow focusable or possibly just learned I have some bugs I don't know about!
emilio commentedon Oct 21, 2021
Seems there's no great compelling argument for the current behavior then... I'm happy to update the WPTs and Gecko. @domenic can / do you want to fix the spec? It'd probably take me a bit more than you, but if you're busy I can try :-)
emilio commentedon Oct 21, 2021
https://bugzilla.mozilla.org/show_bug.cgi?id=1737020 has a patch + tests
domenic commentedon Oct 21, 2021
Sure, I'm happy to fix the spec. I will do it by expanding the scope of #7079.
mfreed7 commentedon Oct 21, 2021
Thanks for tweeting, @domenic. Based on seemingly universal support for not including slotted content, I also agree. Let's land it.
Thanks, I appreciate you gathering some additional input!
Update delegatesFocus to use its shadow tree rather than the flat tree.
Bug 1737020 - Update delegatesFocus to use its shadow tree rather tha…
Update delegatesFocus to use its shadow tree rather than the flat tree.
Bug 1737020 - Update delegatesFocus to use its shadow tree rather tha…
Fixes to delegatesFocus
Fixes to delegatesFocus
Also fix delegatesFocus and autofocus=""
Also fix delegatesFocus and autofocus=""
Update delegatesFocus to use its shadow tree rather than the flat tree.
Fixes to delegatesFocus
Also fix delegatesFocus and autofocus=""
Fixes to delegatesFocus
Also fix delegatesFocus and autofocus=""
Bug 1737020 - Update delegatesFocus to use its shadow tree rather tha…