Open gregwhitworth opened 11 months ago
The Open UI Community Group just discussed Errors for form related controls
, and agreed to the following:
RESOLVED: this is a good problem to solve, but it's independent of the <selectlist>. We should solve this generally.
I've started a draft explainer and research in this Google doc for this since it's going to be a pretty complex problem.
some quick thoughts to consider - some of which border/veer into 'solutions' but that's more just due to me wanting to get the ideas out, rather than trying to imply 'do it this way':
<error for=IDREF_of_input>...</error>
would be nice. Allowing JS or <template>
content, etc., to be injected into those elements as needed.output
element. It is already supposed to be mapped as a live region (status role) in browsers, it can already be associated with a form control via the for
attribute. https://x.com/RogersKonnor/status/1753788382059118952?s=20
This raises an interesting idea? What if we provided an mechanism to get the language strings for a given error message? That way the UI could be completely up to userland?
Perhaps also related to this issue: https://github.com/whatwg/html/issues/9878
There is no currently no way for a Form Associated Custom Element to know it is supposed to report its validity. It only receives an invalid
event when its validity
is not valid
.
I've been meaning to file this issue as we do need a resolution to this prior to
<selectlist>
shipping. HTML has a few capabilities to enable client-side validation upon form submission; such as therequired
attribute. UAs have full control over the anatomy and rendering since like most UI this is not standardized anywhere. For example here are a few renderings when submitted a form that is required.A solution to this will warrant its own explainer, so that is not the goal of this issue; the purpose of this issue is to answer the following question:
To provide a concrete example, let's use
<selectlist>
with a straw proposal for an<error>
element:I'm personally leaning towards doing a binding solution akin to the
popover
API and as I noted a research document will need to be created to influence the solution but that provides the following:<selectlist>
due to potential backwards compat issues