Skip to content
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

Allow aria-invalid on any element? #252

Closed
RoyalIcing opened this issue May 18, 2020 · 5 comments · Fixed by #259
Closed

Allow aria-invalid on any element? #252

RoyalIcing opened this issue May 18, 2020 · 5 comments · Fixed by #259
Labels
bug Something isn't working good first issue Good for newcomers released

Comments

@RoyalIcing
Copy link
Contributor

RoyalIcing commented May 18, 2020

Currently the toBeValid matcher whitelists what elements are allowed:

const FORM_TAGS = ['form', 'input', 'select', 'textarea']

However, AFAIK the ARIA specification allows it on any element:

https://www.w3.org/TR/html-aria/#IDL-ValidityState

The aria-invalid attribute may be used on any HTML element that allows global aria-* attributes except for a submittable element that does not satisfy its validation constraints.

I propose removing the element tag check and allowing it on any element.

My specific issue is with a ol with role radiogroup that I am setting aria-invalid on.

@gnapse
Copy link
Member

gnapse commented May 18, 2020

Yes, I agree. The script element type check should be only when considering the element's checkValidity() return value. But when checking for the presence of aria-invalid any element is ok.

@gnapse gnapse added bug Something isn't working good first issue Good for newcomers labels May 18, 2020
@RoyalIcing
Copy link
Contributor Author

How would you check if it supports checkValidity()'checkValidity' in element?

I am happy to work on this!

@gnapse
Copy link
Member

gnapse commented May 18, 2020

How would you check if it supports checkValidity()

The part that checks what .checkValidity() returns should only be used if the element's type is one of those listed in the FORM_TAGS array. If it's not one of those, the only check that should be tested is the one about the presence of aria-invalid.

I am happy to work on this!

Go for it! And thanks! Thanks a lot.

@missilev
Copy link
Contributor

missilev commented Jun 10, 2020

@BurntCaramel Did you have a chance to work on it? If you are a bit busy now I can take it, I've just come up with a possible solution.

@gnapse
Copy link
Member

gnapse commented Jun 11, 2020

🎉 This issue has been resolved in version 5.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants