Accessibility improvement suggestions
-
Hello! Just found your plugin and it’s looking great. I had a couple of suggestions to improve its accessibility – I hope that is ok!
- Maybe there could be an option for the banner to be added just after the <body> tag. Then someone on a screen reader would not have to tab through the whole page to close the banner – useful when blocking the page when the banner is showing ??
- Optionally, the banner could receive focus on load instead
- An <a> without an href cannot receive focus. They are not treated as links. For example the shortcode nsc_bar_shortcode_show_cookie_banner adds a link which cannot be accessed with the keyboard. Since this does not link somewhere, and activates the banner on click – it should really be a native html <button>. Changing the shortcode function to something like below would fix this and also give the user the ability to provide an optional class name to style it – if necessary
public function nsc_bar_shortcode_show_cookie_banner($attributes) { $linktext = $this->plugin_configs->nsc_bar_get_option("shortcode_link_show_banner_text"); $class = isset($attributes['class']) ? ' class="'. esc_attr($attributes['class']) . '"' : ''; return "<button id='nsc_bar_link_show_banner' style='cursor: pointer;' $class>" . esc_html($linktext) . "</button>"; }
- And this bit I can’t help with because the JS is minified, but when a button is clicked and it opens something, eg – the button above, the focus should move to the banner, and when the banner is closed, the focus should return back to the original trigger.
Do those make sense?? I actually thought the plugin was open source until half-way through writing this! ?? Anyways, I hope the feedback helps, but let me know if you have any doubts.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Accessibility improvement suggestions’ is closed to new replies.