Summary: | Cookie consent banner should be 'focused' on load | ||
---|---|---|---|
Product: | Koha | Reporter: | Martin Renvoize (ashimema) <martin.renvoize> |
Component: | Accessibility | Assignee: | Martin Renvoize (ashimema) <martin.renvoize> |
Status: | Pushed to main --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | domm, jonathan.druart, jonathan.field, m.de.rooy, martin.renvoize, matt.blenkinsop, oleonard |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Small patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: |
25.05.00
|
Circulation function: | |
Attachments: |
Bug 39209: Set cookie consent bar as first focus
Bug 39209: Set cookie consent bar as first focus Bug 39209: Set cookie consent bar as first focus Bug 39209: Set cookie consent bar as first focus |
Description
Martin Renvoize (ashimema)
2025-02-27 11:52:05 UTC
Created attachment 178786 [details] [review] Bug 39209: Set cookie consent bar as first focus This patch updates the cookie consent javascript, when the feature is enabled, to ensure that the cookie consent bar gets focused when it displays. Test plan 1) Enable the CookieConsent preference 2) Open any OPAC page 3) Hit 'tab' and note the display of 'Skip to main content' 4) Confirm that the cookie consent bar is displayed and continued 'tabs' eventually navigate to it 5) Apply this patch 6) Navigate to any OPAC page 7) Hit 'tab' and note that the 'Cookie consent' bar is focused, your keyboard navigation starts with the cookie consent buttons 8) Accept the essential cookies 9) Hit tab and note the focus is back to normal and shows the 'Skip to main content' button on first keyboard navigation. Created attachment 178894 [details] [review] Bug 39209: Set cookie consent bar as first focus This patch updates the cookie consent javascript, when the feature is enabled, to ensure that the cookie consent bar gets focused when it displays. Test plan 1) Enable the CookieConsent preference 2) Open any OPAC page 3) Hit 'tab' and note the display of 'Skip to main content' 4) Confirm that the cookie consent bar is displayed and continued 'tabs' eventually navigate to it 5) Apply this patch 6) Navigate to any OPAC page 7) Hit 'tab' and note that the 'Cookie consent' bar is focused, your keyboard navigation starts with the cookie consent buttons 8) Accept the essential cookies 9) Hit tab and note the focus is back to normal and shows the 'Skip to main content' button on first keyboard navigation. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Thanks for the quick signoff Owen, very much appreciated :) FAIL koha-tmpl/opac-tmpl/bootstrap/js/cookieconsent.js FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl koha-tmpl/opac-tmpl/bootstrap/js/cookieconsent.js` if ( $(window).scrollTop() >= wrapper.offset().top + - wrapper.outerHeight() - - window.innerHeight + wrapper.outerHeight() - + window.innerHeight ) { Now that should be tidy. Dont ask me why :) - document.querySelector('body').setAttribute('tabindex', '-1'); - document.querySelector('body').focus(); - document.querySelector('body').removeAttribute('tabindex'); + document.querySelector("body").setAttribute("tabindex", "-1"); + document.querySelector("body").focus(); + document.querySelector("body").removeAttribute("tabindex"); Also replacing single quotes here. Do we really want that ? Jonathan Druart: Please see previous two comments. (In reply to Marcel de Rooy from comment #5) > - document.querySelector('body').setAttribute('tabindex', '-1'); > - document.querySelector('body').focus(); > - document.querySelector('body').removeAttribute('tabindex'); > + document.querySelector("body").setAttribute("tabindex", "-1"); > + document.querySelector("body").focus(); > + document.querySelector("body").removeAttribute("tabindex"); > > Also replacing single quotes here. Do we really want that ? I believe we had some bits where we replaced with double quotes because of a security risk. And for translatable strings there also used to be a coding guideline, so for example French users don't break JS when using ' in their translations. Do you see an issue with the change? Created attachment 179385 [details] [review] Bug 39209: Set cookie consent bar as first focus This patch updates the cookie consent javascript, when the feature is enabled, to ensure that the cookie consent bar gets focused when it displays. Test plan 1) Enable the CookieConsent preference 2) Open any OPAC page 3) Hit 'tab' and note the display of 'Skip to main content' 4) Confirm that the cookie consent bar is displayed and continued 'tabs' eventually navigate to it 5) Apply this patch 6) Navigate to any OPAC page 7) Hit 'tab' and note that the 'Cookie consent' bar is focused, your keyboard navigation starts with the cookie consent buttons 8) Accept the essential cookies 9) Hit tab and note the focus is back to normal and shows the 'Skip to main content' button on first keyboard navigation. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Amended-by: Jonathan Druart Run tidy.pl (In reply to Marcel de Rooy from comment #6) > Jonathan Druart: Please see previous two comments. I don't understand. I have run tidy.pl and amended the patch. Now all looks good to me. Only new lines added and the QA script is happy. Are we happy here at this stage? Works as advertised (unless you have the "I still don't care about cookies" firedox extension installed, which automatically clicks the least invasive option and thus the consent bar is not shown. So if you have something like that, be sure to disable it before testing...) Created attachment 180385 [details] [review] Bug 39209: Set cookie consent bar as first focus This patch updates the cookie consent javascript, when the feature is enabled, to ensure that the cookie consent bar gets focused when it displays. Test plan 1) Enable the CookieConsent preference 2) Open any OPAC page 3) Hit 'tab' and note the display of 'Skip to main content' 4) Confirm that the cookie consent bar is displayed and continued 'tabs' eventually navigate to it 5) Apply this patch 6) Navigate to any OPAC page 7) Hit 'tab' and note that the 'Cookie consent' bar is focused, your keyboard navigation starts with the cookie consent buttons 8) Accept the essential cookies 9) Hit tab and note the focus is back to normal and shows the 'Skip to main content' button on first keyboard navigation. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Amended-by: Jonathan Druart Run tidy.pl Signed-off-by: Thomas Klausner <domm@plix.at> Pushed for 25.05! Well done everyone, thank you! |