Closed Rocketpilot closed 2 years ago
Yeah proper Aria would be great to add! Shouldn't be too hard to do. I'll take a look at implementing it
@Rocketpilot I just pushed version 1.6 which includes aria-invalid
and aria-errormessage
attributes. I changed the way that error messages are displayed in that it now automatically adds a span.error-msg
element linked by id with the aria-errormessage
attribute. You will have to your css for the error messages but otherwise it is backwards compatible! Read the README for more.
That's amazing, thanks once again. Okay I think I have one more and then I'll be out of your hair haha.
Sorry - one more thing on this - the invalid state no longer seems to clear once the input is updated with text.
Huh. I'll check that today
@Rocketpilot fixed! I introduced a bug right in that last release, but I caught it and now it's fixed in 1.6.1. I really need to set up some tests, other than just general linting.
Make that 1.6.2. Pushed another update as I failed to turn off console.log tests in 1.6.1. That'll teach me to push an update fast in the morning.
You know what they say, git push
in haste, git revert
at leisure. Thanks again!
Per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage, I wonder if it would be possible to add ARIA roles to invalid inputs.
Caveat: The specific way the error is inserted into the page with this tool might make it tricky (the approach described in the link is to insert a span tag containing the error message that's linked via an ID to an aria attribute on the invalid input).