I'm trying to make a complex webapp accessible. The piece I'm working on right now involves getting form field with validation to play nicely with screen readers.
The overall structure is an input tag (#input-with-validation) with javascript that controls the validation. A separate div (#validation-error) is shown or hidden depending on the validation state of the input.
I have it working mostly consistently with JAWS in Chrome, Firefox, and IE on Windows using a combination of role="alert" and aria-live="assertive".
I'm looking for the right way to get this working with Voiceover on OS X (Chrome/Firefox/Safari, or any combination of those). The behavior should be that on each keypress when #input-with-validation has focus, if there is a validation error, it reads the full validation error message to the user from #validation-error.
It should not change focus from #input-with-validation. We can use any combination of wai-aria attributes or change the structure in any way we see fit.
Alternatively, is there a way I can make a javascript call that will tell Voiceover 'read this text now'? That would solve pretty much every issue.
We want to make the internet a more accessible place for everyone, but they certainly aren't making it easy. Thanks for your help!
Note: our page is a complex web application written mainly in React.