-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(select): improve screen reader announcement timing for validation errors #30723
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple questions but non-blocking. Great job!
* since promises are high priority. | ||
*/ | ||
Promise.resolve().then(() => { | ||
this.hintTextID = this.getHintTextID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use a state here instead of calling forceUpdate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment looks like it describes why, though it may have been added after (I appreciate it either way). Maybe @thetaPC found this more reliable than my method of using forceUpdate? My attempt was not perfect, so a more reliable method would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandyscarney I've updated the comment to explain it a bit better: 641f250
* Checks if the input is in an invalid state based | ||
* on Ionic validation classes. | ||
*/ | ||
private checkInvalidState(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to a shared util file since it's used by multiple components?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested and reviewed this and it looks great! I did agree with Brandy's request to move the validation check to a util file since we'll apparently be using it in multiple places, but that's a non-blocking request IMO. Great work!
Issue number: internal
What is the current behavior?
Currently, when an error text is shown, it may not announce itself to voice assistants. This is because the way error text currently works is by always existing in the DOM, but being hidden when there is no error. When the error state changes, the error text is shown, but as far as the voice assistant can tell it's always been there and nothing has changed.
What is the new behavior?
We had to do this with a mutation observer and state because it's important in some frameworks, like Angular, that state changes to cause a re-render. This, combined with some minor aria changes, makes it so that when a field is declared invalid, it immediately announces the invalid state instead of waiting for the user to go back to the invalid field.
Does this introduce a breaking change?
Other information
Preview