Add role="alert" to flashed messages so screen readers announce them#970
Merged
Merged
Conversation
The server-rendered flashed-message banner in base.html had no ARIA role, so screen readers did not announce success or error messages. For example, after an interview e-mails its documents, the "Your documents will be e-mailed to ..." confirmation is a Flask flash rendered by this block, and a screen reader user heard nothing to confirm it was sent. The equivalent JavaScript-injected notification in config.py (NOTIFICATION_MESSAGE) already uses role="alert". This makes the server-rendered path consistent so both are announced. Addresses SuffolkLITLab#47. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
The server-rendered flashed-message banner in
base.htmlhas no ARIA role, so screen readers do not announce success or error messages.Concretely: when an interview e-mails its documents, docassemble calls Flask's
flash("Your documents will be e-mailed to ...", 'success'), which is rendered by this block inbase.html. A screen reader user presses the button, the page reloads, and they hear nothing to confirm the documents were sent. This matters most for the people docassemble-based tools serve, including blind users filling out court and benefits forms on their own.The fix
Add
role="alert"to the flashed-message<div>, matching the JavaScript-injected notification inconfig.py(NOTIFICATION_MESSAGE), which already carriesrole="alert". Both code paths render the same alert markup; this makes the server-rendered one consistent so both are announced. One line, no visible change for sighted users.Addresses SuffolkLITLab#47.