Bug 40782

Summary: Selections toolbar buttons should not be focusable when they are inactive
Product: Koha Reporter: Jake Deery <jake.deery>
Component: OPACAssignee: Jake Deery <jake.deery>
Status: Pushed to oldstable --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: trivial    
Priority: P5 - low CC: fridolin.somers, jake.deery, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
The selections toolbar on OPAC search results now properly manages keyboard focus for disabled buttons. Previously, visually disabled toolbar buttons (such as "Add to cart" or "Add to list" when no items were selected) could still receive keyboard focus, which was confusing for screen reader users. Disabled toolbar buttons now have `tabindex="-1"` applied, making them non-focusable until they become active. When items are selected and the buttons become enabled, they are automatically made focusable again. This enhancement improves the keyboard navigation experience and ensures that assistive technology users are not misled by inactive controls that appear to be interactive.
Version(s) released in:
25.11.00,25.05.04,24.11.10
Circulation function:
Attachments: Bug 40782: Selections toolbar checkbox now adds tabindex -1
Bug 40782: Selections toolbar checkbox now adds tabindex -1
Bug 40782: (follow-up) Tidy results-list.js
Bug 40782: Selections toolbar checkbox now adds tabindex -1

Description Jake Deery 2025-09-10 09:08:17 UTC
On the results page, some toolbar buttons have a disabled class, but can still be focused. This should not be possible, as it is misleading for users of a screen reader.
Comment 1 Jake Deery 2025-09-10 09:09:50 UTC
Created attachment 186310 [details] [review]
Bug 40782: Selections toolbar checkbox now adds tabindex -1

This patch now sets tabindex to -1 if a disabled class is applied to a
control, and removes it when the class evaporates. This improves
accessibility by making these disabled items non-focusable.

To test:
a)  make a search on the OPAC
b)  tab through the selections toolbar, notice how visually disabled
items are focusable
APPLY PATCH
c)  repeat steps a-b, notice how the elements are no longer focusable
SIGN OFF
Comment 2 Owen Leonard 2025-09-10 11:11:42 UTC
Created attachment 186318 [details] [review]
Bug 40782: Selections toolbar checkbox now adds tabindex -1

This patch now sets tabindex to -1 if a disabled class is applied to a
control, and removes it when the class evaporates. This improves
accessibility by making these disabled items non-focusable.

To test:
a)  make a search on the OPAC
b)  tab through the selections toolbar, notice how visually disabled
    items are focusable
APPLY PATCH
c)  repeat steps a-b, notice how the elements are no longer focusable
SIGN OFF

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Owen Leonard 2025-09-10 11:11:45 UTC
Created attachment 186319 [details] [review]
Bug 40782: (follow-up) Tidy results-list.js

Tidy converts single quotes to double quotes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Jonathan Druart 2025-09-16 09:34:33 UTC
Created attachment 186466 [details] [review]
Bug 40782: Selections toolbar checkbox now adds tabindex -1

This patch now sets tabindex to -1 if a disabled class is applied to a
control, and removes it when the class evaporates. This improves
accessibility by making these disabled items non-focusable.

To test:
a)  make a search on the OPAC
b)  tab through the selections toolbar, notice how visually disabled
    items are focusable
APPLY PATCH
c)  repeat steps a-b, notice how the elements are no longer focusable
SIGN OFF

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Bug 40782: (follow-up) Tidy results-list.js

Tidy converts single quotes to double quotes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Lucas Gass (lukeg) 2025-09-18 19:54:47 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Paul Derscheid 2025-09-25 16:31:18 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 7 Fridolin Somers 2025-10-16 07:41:51 UTC
Pushed to 24.11.x for 24.11.10