2842 Adds alert role so error will be announced by screen reader - #6
Conversation
awilfox
left a comment
There was a problem hiding this comment.
r+wc - we need to discuss adding the role to the warning container as well.
I have been looking high and low for any normative reference that I could give for this, since I know it's a common pattern and I know that it's something most do, but I couldn't find any. The only reference I could find to using role="alert" on warning conditions in addition to errors is on the Alert Example in the ARIA Authoring Practices Guide.
|
Since the changes were very similar I rolled [ANW-2843][ANW-2870] into this merge request |
|
@awilfox 💬
as i understand it, things like ARIA patterns you've cited or WCAG techniques (e.g. (Using ARIA |
awilfox
left a comment
There was a problem hiding this comment.
r+wc Looks good, except for the note I left in the log in form.
| <%= form_tag({:controller => "session",:action => "login"}, :method => "post", :class => "login mb-2") do %> | ||
| <p class="alert alert-danger"><%= t "login.login_fail" %></p> | ||
| <p class="alert alert-danger" role="alert"><%= t "login.login_fail" %></p> | ||
| <p class="alert alert-success"><%= t "login.login_success" %>.</p> |
There was a problem hiding this comment.
Would this need that role as well?
And … why does this have a full stop while the other doesn't? Is there a way both could be displayed at the same time?
Is this why the login form looks so weird when I log in?
I don't see anywhere in the tickets where the log in form was noted as failing any accessibility criteria, but the behaviour does feel very surprising. And I don't know how assistive technologies would interpret it.
For an example of what I'm talking about, just log in with an invalid password and then log in with the correct one. You get a red "invalid credentials" and a green "login successful" message.
There was a problem hiding this comment.
That would probably just need role='status' correct?
The selector and element source identify the login error message specifically.
I see what you mean about the login but it looks like that's an existing issue. Should opposing be hidden with javascript? Probably another ticket I'm assuming?
There was a problem hiding this comment.
Yeah, reviewing the ARIA guidance again you are right. role="status" is more appropriate for the success <P/>.
Agreed that the invalid/success being shown at the same time should be its own ticket.
And §3.3.1 discusses errors, not warnings. That's why I was hoping to find any direction about warning conditions in the actual standard. And I didn't find any. But since it is called out in the ARIA pattern, I'm just taking that as "official enough" to say that's the intended behaviour / implementation. |
c9f1cf6 to
a038172
Compare
a038172 to
f228fb0
Compare
Adds alert role to _form_messages for screen readers
Related Ticket (JIRA or GitHub Issue)
[ANW-2842][ANW-2843][ANW-2870]
Summary
Fixes issue with error and warning message not being announced to screen readers
Screenshots (if appropriate):
Types of changes
Checklist: