-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Focus delegate algorithm doesn't consider elements assigned to slot #9245
Comments
Is this a duplicate of #7207? |
In general if you look through https://github.com/whatwg/html/issues?q=%22focus+delegate%22 it looks like we've definitely done this intentionally. On the other hand, maybe at the time we did this, we were thinking mostly of |
Browser support for this is pretty important to development at Adobe. Our Spectrum Web Components library (leveraged in Photoshop, Express, soon to be Illustrator, and many more major efforts at the company) are very interested in moving towards leveraging We'd really appreciate this becoming part of the specification in this area. 🙏🏼 🙇🏼 |
We have the same use case within our Sanoma Learning Design System. We have an |
Yeah, I think it might makes sense to have a different behaviour for However for this use case, the container is not Shadow DOM, but rather cc @emilio in case Emilio has different opinions. |
@Westbrook are you relying on the slot behavior in stable chrome? I am trying to remove it but running into issues in chrome:// pages which also rely on it |
@josepharhar we can’t rely on it due to me not finding a quality test to show it is there, user agent not withstanding. Due to this, we’ve JS’ed around it, but it should work this way in all browsers. Yes, the flat tree can be annoying. Yes, there a many APIs new and old that avoid it and other forms of support for shadow DOM realities. But, shadow DOM is a part of the web platform and it needs to be respected as the number of people who build with it is growing and will continue to making it more and more important to do so. |
A crbug about this has popped up: https://bugs.chromium.org/p/chromium/issues/detail?id=1459293 |
An idea (which I haven't thought through at all): slot element could have a flag/attribute telling whether its assigned nodes should be part of the focus delegation. |
It's a little hard for me to find the rationale for not using the flat tree - can someone summarize? It really seems to me that the focus delegate algorithm, at least for dialogs, should just use the flat tree. Visually, in the presented example, the input is slotted into the dialog and appears there, in flat tree order. It would seem to make sense (to users!) that the first thing focused should be the first thing in the visual order. I don't think we need an attribute or feature to control this, do we? Perhaps I don't understand the "broken" case. |
@domenic I had a WHATNOT action item to ping you about this question, and I dropped the ball. Here's that ping. 😄 I wasn't clear if you feel focus delegate explicitly shouldn't use the flat free, or if you were just concerned given other comments and history. |
I think we decided deliberately that focus delegate for However, I understand the arguments that using the flat tree for So my conclusion is the same as in #9245 (comment): we probably made a mistake assuming that we could use the same "focus delegate" algorithm for both |
This is the part I don't quite yet understand though. Can you help - why is the flat tree wrong for <section>
<template shadowrootmode=open>
<dialog>
<slot></slot>
</dialog>
</template>
<input type="text" />
</section> The |
Sorry, I misunderstood what had happened in the past and flipped the two cases. It seems we decided that focus delegate for The conclusion is the same, though: we should split the algorithms. |
Great! Ok, I do agree with not using the flat tree for
Agreed, assuming someone doesn't make a good case for |
So we can use the flat tree for dialog and popover initial focus then? I can do the chromium/wpt/spec changes |
I'm not into the details of the approaches/algorithms you're using here, but please make sure |
Is this expected?
Consider this test case
The input element will not be focused upon clicking the button according to the current spec.
The text was updated successfully, but these errors were encountered: