Question related to Accessibility of Export button in jquerydatatables

Question related to Accessibility of Export button in jquerydatatables

Gowtham123Gowtham123 Posts: 1Questions: 1Answers: 0
edited March 21 in Free community support

Add role="menu" to export menu div and role="menuitem" for export item.

<div class="dropdown-menu show" style="min-width: 50px; padding-bottom: 0px; padding-top: 0px; position: absolute; transform: translate3d(-1px, 28px, 0px); top: 0px; left: 0px; will-change: transform;" id="dropdownMenuDiv0" aria-labelledby="dropdownbutton0" role="menu" x-placement="bottom-start">
   <a class="buttons-csv buttons-html5 dropdown-item" tabindex="0" href="#" role="menuitem">
      <svg class="svg-inline--fa fa-table fa-w-16" aria-hidden="true" data-prefix="fa" data-icon="table" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg="">
         <path fill="currentColor" d="M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z"></path>
      </svg>
      <!-- <i class="fa fa-table" aria-hidden="true"></i> -->&nbsp;<span>CSV</span>
   </a>
   <a class="buttons-html5 dropdown-item differentCopy" tabindex="0" href="#" role="menuitem">
      <svg class="svg-inline--fa fa-clipboard fa-w-12" aria-hidden="true" data-prefix="far" data-icon="clipboard" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" data-fa-i2svg="">
         <path fill="currentColor" d="M336 64h-80c0-35.29-28.71-64-64-64s-64 28.71-64 64H48C21.49 64 0 85.49 0 112v352c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 400H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h42v36c0 6.627 5.373 12 12 12h168c6.627 0 12-5.373 12-12v-36h42a6 6 0 0 1 6 6v340a6 6 0 0 1-6 6zM192 40c13.255 0 24 10.745 24 24s-10.745 24-24 24-24-10.745-24-24 10.745-24 24-24"></path>
      </svg>
      <!-- <i class="fa fa-clipboard" aria-hidden="true"></i> -->&nbsp;<span>Copy</span>
   </a>
   <a class="buttons-excel buttons-html5 dropdown-item" tabindex="0" href="#" role="menuitem">
      <svg class="svg-inline--fa fa-file-excel fa-w-12" aria-hidden="true" data-prefix="fa" data-icon="file-excel" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" data-fa-i2svg="">
         <path fill="currentColor" d="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"></path>
      </svg>
      <!-- <i class="fa fa-file-excel" aria-hidden="true"></i> -->&nbsp;<span>Excel</span>
   </a>
   <a class="buttons-pdf buttons-html5 dropdown-item" tabindex="0" href="#" role="menuitem">
      <svg class="svg-inline--fa fa-file-pdf fa-w-12" aria-hidden="true" data-prefix="fa" data-icon="file-pdf" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" data-fa-i2svg="">
         <path fill="currentColor" d="M181.9 256.1c-5-16-4.9-46.9-2-46.9 8.4 0 7.6 36.9 2 46.9zm-1.7 47.2c-7.7 20.2-17.3 43.3-28.4 62.7 18.3-7 39-17.2 62.9-21.9-12.7-9.6-24.9-23.4-34.5-40.8zM86.1 428.1c0 .8 13.2-5.4 34.9-40.2-6.7 6.3-29.1 24.5-34.9 40.2zM248 160h136v328c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V24C0 10.7 10.7 0 24 0h200v136c0 13.2 10.8 24 24 24zm-8 171.8c-20-12.2-33.3-29-42.7-53.8 4.5-18.5 11.6-46.6 6.2-64.2-4.7-29.4-42.4-26.5-47.8-6.8-5 18.3-.4 44.1 8.1 77-11.6 27.6-28.7 64.6-40.8 85.8-.1 0-.1.1-.2.1-27.1 13.9-73.6 44.5-54.5 68 5.6 6.9 16 10 21.5 10 17.9 0 35.7-18 61.1-61.8 25.8-8.5 54.1-19.1 79-23.2 21.7 11.8 47.1 19.5 64 19.5 29.2 0 31.2-32 19.7-43.4-13.9-13.6-54.3-9.7-73.6-7.2zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-74.1 255.3c4.1-2.7-2.5-11.9-42.8-9 37.1 15.8 42.8 9 42.8 9z"></path>
      </svg>
      <!-- <i class="fa fa-file-pdf" aria-hidden="true"></i> -->&nbsp;<span>PDF</span>
   </a>
   <a class="buttons-print dropdown-item" tabindex="0" href="#" role="menuitem">
      <svg class="svg-inline--fa fa-print fa-w-16" aria-hidden="true" data-prefix="fa" data-icon="print" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg="">
         <path fill="currentColor" d="M464 192h-16V81.941a24 24 0 0 0-7.029-16.97L383.029 7.029A24 24 0 0 0 366.059 0H88C74.745 0 64 10.745 64 24v168H48c-26.51 0-48 21.49-48 48v132c0 6.627 5.373 12 12 12h52v104c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V384h52c6.627 0 12-5.373 12-12V240c0-26.51-21.49-48-48-48zm-80 256H128v-96h256v96zM128 224V64h192v40c0 13.2 10.8 24 24 24h40v96H128zm304 72c-13.254 0-24-10.746-24-24s10.746-24 24-24 24 10.746 24 24-10.746 24-24 24z"></path>
      </svg>
      <!-- <i class="fa fa-print" aria-hidden="true"></i> -->&nbsp;<span>Print</span>
   </a>
</div>

My screen reader is reading all menuitems in one go. After adding role="menu" and role="menuitem" to menu and menuitems:

How can we make sure my screen reader will read one item on one keydown. is there any updation of plugin. please help us out here.:

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Hi,

    Accessibility is something I really want to get right with DataTables and its extensions, but not being a screen reader user myself, I often struggle to know exactly what I should be doing to ensure that. Do you use a screen reader yourself on a regular basis? If so, your feedback is really valuable - thank you!

    If we take this example, I'm thinking that the div.dt-buttons container element should have role="menubar", and the buttons inside it role="menuitem". Would that be right?

    And role="menu" would be used for dropdowns (collection button types)?

    Allan

Sign In or Register to comment.