Skip to content

2842 Adds alert role so error will be announced by screen reader - #6

Merged
davezuckerman merged 1 commit into
ANW-2833from
ANW-2842-error-message
Sep 28, 2026
Merged

davezuckerman merged 1 commit into
ANW-2833from
ANW-2842-error-message

Conversation

@davezuckerman

@davezuckerman davezuckerman commented Sep 17, 2026 •

Copy link
Copy Markdown

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change, for example API endpoint renaming)
  • My change requires a change to the documentation - If so elaborate:

Checklist:

  • I have read and agree to the CONTRIBUTING document.
  • I have authority to submit this code. - See our licensing
  • Have you added tests to cover these changes? If not why:

@awilfox awilfox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread frontend/app/views/shared/_form_messages.html.erb Outdated
@davezuckerman

Copy link
Copy Markdown
Author

Since the changes were very similar I rolled [ANW-2843][ANW-2870] into this merge request

@anarchivist

anarchivist commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

@awilfox 💬

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.

as i understand it, things like ARIA patterns you've cited or WCAG techniques (e.g. (Using ARIA role=alert or Live Regions to Identify Errors) are not normative, as it's the success criteria that define the normative behavior (in this case, §3.3.1 and §4.1.3 are normative.)

@anarchivist anarchivist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+.

@awilfox awilfox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@awilfox

awilfox commented Sep 22, 2026

Copy link
Copy Markdown
Member

@awilfox 💬

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.

as i understand it, things like ARIA patterns you've cited or WCAG techniques (e.g. (Using ARIA role=alert or Live Regions to Identify Errors) are not normative, as it's the success criteria that define the normative behavior (in this case, §3.3.1 and §4.1.3 are normative.)

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.

@davezuckerman
davezuckerman merged commit bb9dc2e into ANW-2833 Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants