w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
178 stars 48 forks source link

Provide a way to set aria-invalid on a file input element #457

Closed backwardok closed 1 year ago

backwardok commented 1 year ago

For an <input type="file">, there are many scenarios that would result in an invalid file chosen, whether the file type is incorrect or the file size is too large, or there was an issue with the file itself.

The ARIA in HTML doc indicates that file input types have no role. In ARIA 1.2, aria-invalid is no longer a global attribute. This makes it so that it's not possible to apply the invalid state to a file input type.

It would be great to either revert aria-invalid back to a global property, or to add a file input type role and add it to the list of roles that aria-invalid is supported on.

stevefaulkner commented 1 year ago

@backwardok

It would be great to either revert aria-invalid back to a global property

that is the purview of the ARIA spec

or to add a file input type role and add it to the list of roles that aria-invalid is supported on.

hmm

an option, as long as it is exposed by browsers in the acc tree, is to allow it on input type=file from a quick test on chrome/firefox on windows the invalid state is exposed as expected.

@scottaohara, @patrickhlauke any input on this?

backwardok commented 1 year ago

that is the purview of the ARIA spec

Ah I didn't notice that I wasn't filing for the ARIA repo - I will (also?) file a ticket there!

stevefaulkner commented 1 year ago

@backwardok yeah the scope of the ARIA in HTML spec is

This specification defines the authoring rules (author conformance requirements) for the use of Accessible Rich Internet Applications (WAI-ARIA) 1.2 and Digital Publishing WAI-ARIA Module 1.0 attributes on [HTML] elements. This specification's primary objective is to define requirements for use with conformance checking tools used by authors (i.e., web developers). These requirements will aid authors in their development of web content, including custom interfaces and widgets, which make use of ARIA to complement or extend the features of the host language.

backwardok commented 1 year ago

Related issue filed for ARIA: https://github.com/w3c/aria/issues/1926

backwardok commented 1 year ago

From @scottaohara via Slack:

it’s valid on an input type=file, so aria in html needs to be updated to reflect that

Not sure what other ARIA attributes work for <input type="file"> outside of the global set, but sounds like there's at least an issue to update the ARIA in HTML doc to reflect that it can support aria-invalid?

backwardok commented 1 year ago

Thank you!