-
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 missing features #5016
Comments
/cc @tkent-google. I think required might be already integrated but I am not sure. In general it's unclear how much here is complicated underlying semantics vs. just allowing elements to set booleans that map directly to psuedo classes. Thus @tkent-google's original suggestion that you could set built-in pseudoclasses with ElementInternals, but we made that a "v2" feature to focus on :state() first. |
I think some of this is also exposed to a11y trees in which case a semantic boolean would be better for developers I think. |
cc @whatwg/a11y |
This is a dupe of WICG/webcomponents#813 and WICG/webcomponents#814. |
I think it only is if you do not consider the a11y tree. (Which is why it's annoying that's not specified in HTML, as it's easily overlooked.) But also, I think we should also track such ideas here as it affects HTML in the end. cc @whatwg/forms |
While your parenthetical statement is orthogonal to this issue, is the HTML Accessibility API Mappings not providing what you need? Should WHATWG's HTML spec provide a prominent link so it is not overlooked? |
That would certainly help and is being tracked by #3282. I ended up filing w3c/html-aam#257 for readonly/disabled, as a start. |
The distinction between My impression is that, because the "default path" for FACE authors is to have non-useful readonly behavior, @tkent-google set up the current design to have them not match the CSS pseudo-classes. Instead, the vision was that we would use some future mechanism (like WICG/webcomponents#813) to allow authors to manually set up the pseudo-classes while they were also setting up the rest of their control-specific readonly behavior. This still seems reasonable to me, but I am open to changing it. It seems like the other tenable position is that |
UAs need to detect whether a FACE is text-editable or not to detect |
I think a better default for form controls is that they are editable. And also, from its current definition it seems that |
See #3501 for the interop issues with |
Cross-posting here as this seems to be the right place. When calling In the given sample in the doc... ....and in all other examples that I've found it is also a bit weird that the validity will be set whenever the input changes as this is may be a very expensive operation. I'd also expect to have a but this seems not to work (quite yet)? It would be so cool to be able to implement a custom element that can be used as a drop-in replacement for native input fields or to add new exciting input controls, but right now I don't see a way to do so due to the issues above.
|
Can you not use the invalid event? |
Yes, I could fire an invalid event just like native input elements - once my reportValidation() method would get invoked. But it is never called. |
Sorry, I think the way this works is that you use |
Thanks, will do. |
Component developers would not override the public API. They would have some kind of callback or something on |
As stated above the problem is that there is no way to create a custom element that |
The |
Thanks for the valuable info! (1) was not working for me. I'll give (3) a try. Would be great to have a working example somewhere. It would make custom elements so much more useful if that worked. |
Can someone compile a list of things we need to tackle? Maybe we can discuss it in fall. |
@rniwa I think the list in OP is still accurate and given that it's not just pseudo-classes I rather have a solution that works for both pseudo-classes and AT/equivalent tools than requiring detailed work for each. |
some additional attributes that need to be spec'd for FACES which aren't in the OP.
|
@domenic ping on reconsidering |
So re-reading the thread, I guess we have a few options:
(1) seems bad since it means you could not create controls like range, color, checkbox, etc. which do not support So I think our choices are between pursuing WICG/webcomponents#813 and pursuing something like (3). I worry about (3) since it seems very special-casey and we haven't heard any author demand for readonly-supporting FACEs. I'd be surprised if readonly FACEs were the top priority to add among all the other things in the OP. And I think WICG/webcomponents#813 would solve a lot of other items listed in the OP. |
Note that FACEs can get correct AT behavior here for max/min by setting For autocomplete, I think allowing FACE to accept autocomplete is an unsolved problem and pretty difficult given that it involves the integration of user agent UI with arbitrary author-drawn content. |
I don't know if it's ever been mentioned, but I think FACEs are also missing:
I imagine something like a class MyInput extends HTMLElement {
static observedAttributes = ['list', /* ... */];
// ...
attributeChangedCallback(name, oldValue, newValue) {
if (name === 'list') {
this.#internals.list = this.getRootNode().getElementById(newValue);
}
// ...
}
get list() {
return this.#internals.list;
}
} ... now the tricky part: how to actually place the dropdown? For The other issue is controlling when the dropdown should open. In Chromium/Safari it opens as soon as the control is focused, but not in Firefox, for example. What do you folks think? |
Hmm. I always thought of "the ability to have an associated datalist" as something very specific to text inputs that they implement themselves (similar to how they implement cursor movement and selection). But I could see an argument for it being a more general capability... |
Would solving this issue provide a path forward to solving the unresolved problem of |
I was looking at pseudo-classes and it seems that FACEs miss a couple of features:
<input type=checkbox checked>
and<option selected>
match:default
)The text was updated successfully, but these errors were encountered: