Closed (fixed)
Project:
Drupal voor Gemeenten
Version:
7.x-1.x-dev
Component:
DvG custom module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 Dec 2020 at 13:03 UTC
Updated:
5 Feb 2021 at 07:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tvoesenek commentedThis patch adds the
role="button"attribute to the "Close this banner"--tag.Comment #3
dennis cohn commentedIt's better to use the semantic
<button>element instead of a link acting like a button.Otherwise you will need to make the element focusable and have to define event handlers for click and keydown events (Enter and Space keys for example..
If you can't change it for styling issues, add a
tabindex="0"to the element.Comment #4
bskibinskiThis is indeed to prevent broken styling, a native button element would be better, but would require manual styling for all the sites.
It's still an
<a>tag, so `focus` and `enter` keys should still work (just tested it, and those do work).mouseclick events are already handled by the javascript.
You are right about capturing the spacebar key though.
Comment #5
bskibinskiTried to remove the unnecessary href attribute from the link, but drupal converts it into a span, which would also break styling on a lot of sites.
Added tabindex 0 just to be sure when someone wants to fix it in another way, doesn't hurt it for now.
Changed the title attribuut to an aria-label for better pronunciation by screenreaders.
And altered the javascript to also capture the spacebar (and also enter/click). (might not be the best/prettiest JS, but it works).
Comment #6
joshahubbers commentedScript works.
Comment #7
joshahubbers commentedComment #8
joshahubbers commented