Summary: | 'Refine your search' should have an aria-expanded attribute | ||
---|---|---|---|
Product: | Koha | Reporter: | Chloé Zermatten <chloe.zermatten> |
Component: | Accessibility | Assignee: | Chloé Zermatten <chloe.zermatten> |
Status: | Signed Off --- | QA Contact: | Julian Maurice <julian.maurice> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, jonathan.druart, julian.maurice, m.de.rooy, martin.renvoize, matt.blenkinsop, oleonard |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Small patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This fixes the "Refine your search" section in the OPAC. For screen reader users on smaller screens, it now correctly announces that it is an expandable section, instead of a link (by adding an aria-expanded attribute).
Explanation: The 'Refine your search' expandable section in the Koha OPAC was not clearly announced by screen readers for smaller screen sizes. This is because the expandable section was identified and announced as a link. This resulted in screen reader users incorrectly expecting a link to another page, and not being informed that it was an expandable section.
|
|
Version(s) released in: | Circulation function: | ||
Attachments: |
Bug 39489: 'Refine your search' aria-expanded attribute
Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute Bug 39489: 'Refine your search' aria-expanded attribute |
Description
Chloé Zermatten
2025-03-31 09:37:00 UTC
Created attachment 180300 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon the section being expanded. To test: 1) Apply the patch. 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 Created attachment 180705 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon the section being expanded. To test: 1) Apply the patch. 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> 1) If I load the page on a large screen, the facets are shown but aria-expanded attribute is "false". Shouldn't it be "true" ? or even removed (since it's not collapsible) ? 2) setAriaExpandable toggles the attribute value for all .menu-collapse-toggle on the page no matter which one is clicked. This isn't a real issue currently as there is only one .menu-collapse-toggle per page, but it could become an issue if other similar sections are introduced, and it can be easily fixed. (In reply to Julian Maurice from comment #3) > 1) If I load the page on a large screen, the facets are shown but > aria-expanded attribute is "false". Shouldn't it be "true" ? or even removed > (since it's not collapsible) ? > > 2) setAriaExpandable toggles the attribute value for all > .menu-collapse-toggle on the page no matter which one is clicked. This isn't > a real issue currently as there is only one .menu-collapse-toggle per page, > but it could become an issue if other similar sections are introduced, and > it can be easily fixed. Thank you for the feedback! Agreed on both counts, will update the patch to account for both. Created attachment 181372 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. Created attachment 181568 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD): 1. To display the "Most popular" link under the search box, set the OpacTopissue system preference to "Allow". 2. To see the full history for a subscription: 2.1 Set the SubscriptionHistory system preference to "full history". 2.2 Set up a serial using the serials module (no need to add any items). 2.3 View the record in the OPAC 2.4 Select the Subscriptions tab. 2.5 Click the "More details" link under the latest issues table. 2.6 You should now be on the full subscription history page for the serial. Not my expertise area but IMO we should not see screen size in JS: + if (window.screen.width > 991) { + $(".menu-collapse-toggle").removeAttr("aria-expanded"); + } Cannot we avoid that? Do we want the attribute to be adjusted if the window is resized? Could we have aria-expanded adjusted depending on the arrow visibility? Created attachment 182489 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. 16) Resize your viewport below 992px, and notice that 'aria-expanded' reappears and is set to false. 17) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to false. 18) Open 'Refine your search', notice that 'aria-expanded' is set to true. 19) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to true. Note: now updated to handle screen resizes (In reply to Jonathan Druart from comment #8) > Not my expertise area but IMO we should not see screen size in JS: > > + if (window.screen.width > 991) { > + $(".menu-collapse-toggle").removeAttr("aria-expanded"); > + } > > Cannot we avoid that? > > Do we want the attribute to be adjusted if the window is resized? > > Could we have aria-expanded adjusted depending on the arrow visibility? Thank you for the feedback! I had a go at implementing this, hopefully it addresses the points you raised Created attachment 182565 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. 16) Resize your viewport below 992px, and notice that 'aria-expanded' reappears and is set to false. 17) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to false. 18) Open 'Refine your search', notice that 'aria-expanded' is set to true. 19) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to true. Note: now updated to handle screen resizes Signed-off-by: David Nind <david@davidnind.com> Comment on attachment 182565 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute Review of attachment 182565 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/opac-tmpl/bootstrap/js/results-list.js @@ +240,4 @@ > KOHA.Tags.add_tag_button(thisid, tag); > return false; > }); > + $(window).on("resize load", function () { This is not needed: there is already a function (facetMenu) called on load and whenever the screen width goes under or above the break point of 992px (and only in that case, not on every resize) You should put the aria-expanded logic in facetMenu @@ +244,5 @@ > + $(".menu-collapse-toggle").each(function () { > + const beforeContent = window.getComputedStyle( > + this, > + "::before" > + ).content; You should avoid relying on style to define behavior, because whenever the style change it might break functionality. Created attachment 182735 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. 16) Resize your viewport below 992px, and notice that 'aria-expanded' reappears and is set to false. 17) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to false. 18) Open 'Refine your search', notice that 'aria-expanded' is set to true. 19) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to true. Note: now updated to handle screen resizes (In reply to Julian Maurice from comment #12) > Comment on attachment 182565 [details] [review] [review] > Bug 39489: 'Refine your search' aria-expanded attribute > > Review of attachment 182565 [details] [review] [review]: > ----------------------------------------------------------------- > > ::: koha-tmpl/opac-tmpl/bootstrap/js/results-list.js > @@ +240,4 @@ > > KOHA.Tags.add_tag_button(thisid, tag); > > return false; > > }); > > + $(window).on("resize load", function () { > > This is not needed: there is already a function (facetMenu) called on load > and whenever the screen width goes under or above the break point of 992px > (and only in that case, not on every resize) > You should put the aria-expanded logic in facetMenu > > @@ +244,5 @@ > > + $(".menu-collapse-toggle").each(function () { > > + const beforeContent = window.getComputedStyle( > > + this, > > + "::before" > > + ).content; > > You should avoid relying on style to define behavior, because whenever the > style change it might break functionality. Thank you for the pointers - patch amended accordingly! Changed to signed off, ready for QA again. (I don't think it needs to be tested again, as this is just incorporating QA feedback.) Please add a signoff line. Created attachment 183057 [details] [review] Bug 39489: 'Refine your search' aria-expanded attribute On smaller screens (phones, tablets), the 'Refine your search' expandable section in the Koha OPAC is not clearly announced by screen readers. The reason for this is that the expandable section toggle button is instead identified and announced as a link. This results in screen reader users incorrectly expecting to be redirected to another page, and not being informed that there is a expandable section. For elements with a class of menu-collapse-toggle, add an aria-expanded attribute which defaults to false, and is toggled to true upon that specific section being expanded. If the screen width is 992px or higher, then remove the aria-expanded attribute on load as it is irrelevant, and potentially misleading. To test: 1) Apply the patch. on a small screen: 2) Run a library catalogue search in the Koha OPAC. 3) Right click on the page to inspect it. 4) Inspect the 'Refine your search' element. 5) Notice that it now has a aria-expanded attribute which is set to false. 6) Open the expandable 'Refine your search' section. 7) Notice that the aria-expanded attribute on the 'Refinine your search' element is now set to true. 8) Navigate to Home > Most popular titles 9) Repeat steps 3-7 10) Navigate to Home > Details for > Full subscription history 11) Repeat steps 3-7 then, on a bigger screen (992px and above) 12) Run a library catalogue search in the Koha OPAC. 13) Right click on the page to inspect it. 14) Inspect the 'Refine your search' element. 15) Notice that there is no 'aria-expanded' attribute, as in this case the section isn't expandable. 16) Resize your viewport below 992px, and notice that 'aria-expanded' reappears and is set to false. 17) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to false. 18) Open 'Refine your search', notice that 'aria-expanded' is set to true. 19) Resize your viewport while remaining below the 992px limit, and notice that 'aria-expanded' remains set to true. Note: now updated to handle screen resizes Signed-off-by: David Nind <david@davidnind.com> |