-
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
Form-associated custom elements and interactive content #5423
Comments
Hmm, I'm having second thoughts. Maybe this should be a separate toggle, not automatic with form-associated custom elements? I noticed the following elements are form-associated but not interactive content:
If we said that form-associated custom elements are automatically interactive content, then this would mean form-associated custom elements cannot emulate the behavior of elements like the above. Maybe we should leave interactive content-or-not for WICG/webcomponents#762. |
No. But labelable elements is observable from If a form-associated element is also listed, it can show up in the
44e3160 |
Yes? Whether something is interactive contact or not observes how the element interacts with label's activation behavior. See #5414 for a recent instance where this is important. |
Oh, I see. Sorry, I thought you were talking about what could be the label's control. I see this now:
|
Having understood this issue better now, I agree with your second comment that interactive content shouldn't be implied by being form-associated. Are there cases of form-associated custom elements that you think should be interactive content but wouldn't also be focusable? |
I think anything wanting to emulate |
They are not interactive content, though. |
I wonder if changing 'descendant' to 'shadow-including descendant' is enough. https://html.spec.whatwg.org/C/#the-label-element:activation-behaviour-2
|
Oh, oops, you are right. OK, answering your actual question:
In the spec sense of "focusable", i.e. programmatically focusable, I can think of no such cases. (Note: they may not necessarily be sequentially or click focusable, especially on macOS.) The spec doesn't currently enforce this relationship, since it leaves the question of what is focusable entirely up to the browser, but I think it's safe to say that the relationship must hold for custom elements. And perhaps we should even enforce the relationship for browsers too.
This seems like a separate issue from what's being discussed here, about form-associated custom elements. E.g., it wouldn't impact https://boom-bath.glitch.me/face-interactive-content.html. But, we probably should consider changing it in the way you describe, as a separate fix. |
OK so, if a custom element is both form-associated and focusable (because it has Right now all form-associated custom elements are "labelable" per spec afaict. Since there are native form-associated elements that aren't labelable, maybe they shouldn't be labelable when they aren't focusable (e.g. for |
Hmm, wait |
I'm currently tapping into FACE for the purpose of making a psuedo Given the following tree: <x-card inert={disabled}>
<slot>
<x-button>Go</x-button>
<slot>
</x-card> The x-button will not inherit, disabled state but will be inert and tabskipped. Caveat is that those form elements didn't technically get disabled and will appear in forms. |
So FACEs are already labelable, but not interactive. Making them also always interactive seems like it would solve this issue (except for |
I missed #5423 (comment) Maybe allow an override, but make FACEs interactive by default? |
I wonder if whatever solution is devised (eg: Side note: |
WCCG had their spring F2F in which this was discussed. You can read the full notes of the discussion (WICG/webcomponents#978 (comment)), heading entitled "Enhancements to Form-Associated Custom Elements". The discussion concluded with present members of WCCG feeling as though FACEs should be labellable (and already are, per-spec), but interactivity will need changes to specification. |
Similar to #5414 (about tabindex="0" and interactive content) but with less compat constraints.
Currently in the spec and in Chromium form-associated custom elements are not treated as interactive content. This is observable in how they affect
<label>
elements. See demo at https://boom-bath.glitch.me/face-interactive-content.html .I think we should change the spec and Chromium, and add some tests, to fix this.
Thoughts, @TimothyGu @tkent-google @whatwg/components @whatwg/forms?
The text was updated successfully, but these errors were encountered: