Bug 39494 - Announce status messaging on login page
Summary: Announce status messaging on login page
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Chloé Zermatten
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-31 12:02 UTC by Chloé Zermatten
Modified: 2025-05-13 16:47 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39494: Announce status messaging on login page (7.14 KB, patch)
2025-04-08 16:14 UTC, Chloé Zermatten
Details | Diff | Splinter Review
Bug 39494: Announce status messaging on login page (7.20 KB, patch)
2025-04-08 23:35 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 39494: Announce status messaging on login page (7.18 KB, patch)
2025-05-09 14:36 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chloé Zermatten 2025-03-31 12:02:03 UTC
On the login page, the error messaging container currently does not include an aria-live attribute. It also does not have a role attribute set to alert. This is an issue for screen reader users.

Both attributes should be set to a container that is present when the page first loads so that screen readers may monitor those for status changes, and notify the user as required. Otherwise, screen reader users will not be made aware that their login attempt failed if/when it does.
Comment 1 Chloé Zermatten 2025-04-08 16:14:32 UTC
Created attachment 180727 [details] [review]
Bug 39494: Announce status messaging on login page

So that screen readers announce errors, add a role attribute set to "alert" and a aria-live attribute set to "assertive".

Since the page reloads on each login attempt, the page will effectively be loaded with both attributes set (if there is an error) and so screens readers should be able to detect and announce the message.

Test plan:

1) On the Koha OPAC, navigate to Home > Log in to your account
2) Attempt to login, entering an incorrect password
3) Inspect the HTML, and notice that the relevant element now has a role attribute set to "alert" and an aria-live attribute set to "assertive".

Repeat steps 2-3, but instead of an incorrect password error, trigger:
A) a timeout error
B) a different IP address error
C) a too many login attempts error
D) an authorisation error (where we are authenticating with a third party)
E) a shibboleth authentication error
F) a CAS login error
G) an invalid username/password error for an anonymous patron
H) an anonymous patron error
I) a password expired error
Comment 2 Chloé Zermatten 2025-04-08 16:20:18 UTC
Note:
The current patch is likely the simplest / most basic solution to implement that came to mind.

Another approach might be to rewrite the error messages in opac-auth.tt so that they all use a shared <div class="alert alert-info"><p aria-live="off" role="alert"></p></div> element, dynamically setting aria-live to "assertive" when relevant, and passing the appropriate message. It would likely also involve adding a method in Auth.pm to assign the relevant error message.

I will happily go with either, but though I would start with the simplest.
Comment 3 Brendan Gallagher 2025-04-08 23:35:32 UTC
Created attachment 180736 [details] [review]
Bug 39494: Announce status messaging on login page

So that screen readers announce errors, add a role attribute set to "alert" and a aria-live attribute set to "assertive".

Since the page reloads on each login attempt, the page will effectively be loaded with both attributes set (if there is an error) and so screens readers should be able to detect and announce the message.

Test plan:

1) On the Koha OPAC, navigate to Home > Log in to your account
2) Attempt to login, entering an incorrect password
3) Inspect the HTML, and notice that the relevant element now has a role attribute set to "alert" and an aria-live attribute set to "assertive".

Repeat steps 2-3, but instead of an incorrect password error, trigger:
A) a timeout error
B) a different IP address error
C) a too many login attempts error
D) an authorisation error (where we are authenticating with a third party)
E) a shibboleth authentication error
F) a CAS login error
G) an invalid username/password error for an anonymous patron
H) an anonymous patron error
I) a password expired error

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 4 Martin Renvoize (ashimema) 2025-05-09 14:36:51 UTC
Created attachment 182187 [details] [review]
Bug 39494: Announce status messaging on login page

So that screen readers announce errors, add a role attribute set to "alert" and a aria-live attribute set to "assertive".

Since the page reloads on each login attempt, the page will effectively be loaded with both attributes set (if there is an error) and so screens readers should be able to detect and announce the message.

Test plan:

1) On the Koha OPAC, navigate to Home > Log in to your account
2) Attempt to login, entering an incorrect password
3) Inspect the HTML, and notice that the relevant element now has a role attribute set to "alert" and an aria-live attribute set to "assertive".

Repeat steps 2-3, but instead of an incorrect password error, trigger:
A) a timeout error
B) a different IP address error
C) a too many login attempts error
D) an authorisation error (where we are authenticating with a third party)
E) a shibboleth authentication error
F) a CAS login error
G) an invalid username/password error for an anonymous patron
H) an anonymous patron error
I) a password expired error

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 5 Martin Renvoize (ashimema) 2025-05-09 14:38:02 UTC
Simple is good to start, thanks Chloe.

Refactoring-wise, I think perhaps we can do that another time or highlight the idea to Owen :)

Passing QA, this is a small but important accessibility improvement which causes no regressions for general users.
Comment 6 Katrin Fischer 2025-05-13 16:47:45 UTC
Pushed for 25.05!

Well done everyone, thank you!