mercredi 16 mai 2018

How do I make my custom checkbox accessible?

I'm trying to implement more accessibility to the website I'm working on. I have a custom checkbox inside a button, followed by a list of checkboxes. When I'm using a screenreader, I expect the screen reader to tell me whenever a checkbox is unmarked/marked. This works for all the checkboxes, except the one inside my button. The purpose of the button is to mark/unmark all other checkboxes in the list (this is done by JavaScript). Everything works, except the screenreader is not saying anything when I unmark/mark it.

Here the code:

<button id="checkAll" class="btn btn-default checkAll checkAllInit" 
data-target="#allSenders">
<span class="icon icm icm-checkbox_select" role="checkbox"></span>
<span class="text">Avmarkera alla</span></button>

What follows is basically a list of checkboxes, which all can be reached and understood by keyboard navigation and the screen reader. It's just the button that won't give the correct feedback.

Any suggestions appreciated.




Aucun commentaire:

Enregistrer un commentaire