Project

General

Profile

Development #85003

améliorer l'accessibilité des section/foldable

Added by Frédéric Péters 4 months ago. Updated 4 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
21 December 2023
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Le code dans w.c.s. contient une gestion de l'accessibilité que ne contient pas gadjo, (tabindex, role bouton, clavier, aria-expanded),

  $('.section.foldable > h2 [role=button]').each(function() {
     $(this).attr('tabindex', '0');
  });
  $('.section.foldable > h2 [role=button]').on('keydown', function(ev) {
    if (ev.keyCode == 13 || ev.keyCode == 32) {  // enter || space
      $(this).trigger('click');
      return false;
    }
  });
  $('.section.foldable > h2').off('click').click(function() {
     var folded = $(this).parent().hasClass('folded');
     var $button = $(this).find('[role=button]').first();
     if ($button.length) {
       $button[0].setAttribute('aria-expanded', `${folded}`);
     }
     $(this).parent().toggleClass('folded');
     ...

Also available in: Atom PDF