nico3333fr / jquery-accessible-accordion-aria

jQuery Accessible Accordion System, using ARIA
MIT License
60 stars 19 forks source link

HTML5 semantic enhancement proposal #7

Closed raratiru closed 8 years ago

raratiru commented 8 years ago

I would like to propose a semantic enhancement:

It seems safe to presume that each accordion tab represents a thematic grouping of content, and therefore it would be semantically correct to enclose it in a <section> element:

<div class="js-accordion" data-accordion-prefix-classes="your-prefix-class">
  <section>
    <h2 class="js-accordion__header">First tab</h2>
    <div class="js-accordion__panel">
      <p>Content of 1st tab</p>
    </div>
  </section>
  <section>    
    <h2 class="js-accordion__header">Second tab</h2>
    <div class="js-accordion__panel">
      <p>Content of 2nd tab</p>
    </div>
  </section>
  <section>
    <h2 class="js-accordion__header">Third tab</h2>
    <div class="js-accordion__panel">
      <p>Content of 3rd tab</p>
    </div>
  </section>
</div>

Currently this is not possible because it breaks the keyboard navigation.

I have found out that the code needing refactoring is the $accordion selector around the document but my JQuery skills do not permit me more.

For example, changing the relevant lines to $accordion = $this.parent().parent(), I achived to navigate with the keyboard only to the first and last tab.

raratiru commented 8 years ago

I have just installed jquery-accessible-hide-show-aria and works as expected out of the box.

Chuck is -right now- losing a tear.