Giter Site home page Giter Site logo

matthiasott / a11y-accordion-tabs Goto Github PK

View Code? Open in Web Editor NEW
70.0 70.0 6.0 202 KB

A script for an accessible accordion tabs component

License: MIT License

JavaScript 99.47% Makefile 0.53%
a11y accessibility accordion aria component html javascript tabs ui-components

a11y-accordion-tabs's Introduction

Hi! 👋🤗

I’m Matthias. I'm an independent UX designer and UI engineer, teacher, and occasional speaker. I teach Interface Prototyping at Muthesius Academy of Fine Arts and Design and run workshops on designing and prototyping. I publish the newsletter Own Your Web. On this account, I build a lot of prototypes, work on client projects, and a few (IndieWeb) side projects.

If you want to learn more or get in touch, visit my personal website and blog https://matthiasott.com or chat with me on Mastodon, where I’m @matthiasott.

a11y-accordion-tabs's People

Contributors

dependabot[bot] avatar matthiasott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

a11y-accordion-tabs's Issues

Deeplinking addon?

Would it be possible to have a deeplink option with this tab set?

Clicking on the tab would add the hash to the end of the url. Like example below:

site.com/#tab-04
This would bring you directly to the 4th tab in the set?

Can you support using data attributes?

Thanks for the great work. Can or does it support using data attributes to change settings? For instance when you use the Slick Slider js, you can add data attributes for specific settings like:

I would like to change/call settings straight from the html.

Thank you once again for this.

Tabs start expanded with accordion start collapsed?

Can there be separate collapsible options for the tabs vs accordions? I would like the tabs to always start expanded and the accordion to start collapsed. I only see a global startCollapsed property. Thanks!

Support for multiple a11y tabs in the same page, parent tabs loaded when child tabs are clicked

Hello,

I would like to implement child tab inside a parent tab, as below, however when the child tabs are clicked the parent tabs are loaded.

Does a11y support this functionality?

<section class="accordion-tabs js-tabs" data-tabs-allowed="true" data-breakpoint="400" data-start-collapsed="false">
      <ul role="tablist" class="tabs-tab-list">
          <li role="presentation"><a id="tab1" href="#section1" role="tab" aria-controls="section1" aria-selected="true" class="tabs-trigger js-tabs-trigger">Section 1</a></li>
          <li role="presentation"><a id="tab2" href="#section2" role="tab" aria-controls="section2" class="tabs-trigger js-tabs-trigger">Section 2</a></li>
          <li role="presentation"><a id="tab3" href="#section3" role="tab" aria-controls="section3" class="tabs-trigger js-tabs-trigger">Section 3</a></li>
      </ul>
      <section id="section1" role="tabpanel" aria-labelledby="tab1" class="tabs-panel js-tabs-panel" tabindex="0">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section1" aria-expanded="true" tabindex="0">Section 1 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span>
          <svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg>
        </div></div>
        <div class="content" aria-hidden="false">
          <h2>Headline Section 1</h2>
          <ul role="tablist" class="tabs-tab-list">
          <li role="presentation"><a id="tab11" href="#section11" role="tab" aria-controls="section11" aria-selected="true" class="tabs-trigger js-tabs-trigger">Section 11</a></li>
          <li role="presentation"><a id="tab12" href="#section12" role="tab" aria-controls="section12" class="tabs-trigger js-tabs-trigger">Section 12</a></li>
          <li role="presentation"><a id="tab13" href="#section13" role="tab" aria-controls="section13" class="tabs-trigger js-tabs-trigger">Section 13</a></li>
      </ul>
      <section id="section11" role="tabpanel" aria-labelledby="tab11" class="tabs-panel js-tabs-panel">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section11" aria-expanded="false" tabindex="0">Section 11 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span>
          <svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg>
        </div></div>
        <div class="content" aria-hidden="false">
          <h2>Headline Section 1</h2>
          <p>Cum prefrontal cortex horribilem walking fornix dead resurgere brains de crazed limbic cortex optic nerve sepulcris creaturis, braaaaaiins zombie sicut hypothalamus de <a href="#">grave hippocampus feeding</a> iride brainz et serpens. Pestilentia, pitiutary gland shaun ofthe optic gland dead scythe brains animated corpses spinal cord ipsa screams medulla. Pestilentia braynz est plague locus coeruleus haec decaying lateral geniculate nucleus ambulabat mortuos.</p>
        </div>
      </section>
      <section id="section12" role="tabpanel" aria-labelledby="tab12" class="tabs-panel js-tabs-panel">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section12" aria-expanded="false" tabindex="0">Section 12 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span><svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg></div></div>
        <div class="content" aria-hidden="true">
          <h2>Headline Section 12</h2>
          <p>Zombie ipsum brains reversus ab cerebellum viral inferno, brein nam rick mend grimes malum cerveau cerebro. De carne cerebro lumbering animata cervello corpora quaeritis. Summus thalamus brains sit​​, morbo basal ganglia vel maleficia? De braaaiiiins apocalypsi gorger omero prefrontal cortex <a href="#">undead survivor</a> fornix dictum mauris. Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve, imo evil braaiinns stalking monstra hypothalamus adventus resi hippocampus dentevil.</p>
        </div>
      </section>
      <section id="section13" role="tabpanel" aria-labelledby="tab13" class="tabs-panel js-tabs-panel">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section13" aria-expanded="false" tabindex="0">Section 13 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span><svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg></div></div>
        <div class="content" aria-hidden="true">
          <h2>Headline Section 13</h2>
          <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De <a href="#">carne lumbering animata</a> corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. </p>
        </div>
      </section>
        </div>
      </section>
      <section id="section2" role="tabpanel" aria-labelledby="tab2" class="tabs-panel js-tabs-panel">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section2" aria-expanded="false" tabindex="0">Section 2 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span><svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg></div></div>
        <div class="content" aria-hidden="true">
          <h2>Headline Section 2</h2>
          <p>Zombie ipsum brains reversus ab cerebellum viral inferno, brein nam rick mend grimes malum cerveau cerebro. De carne cerebro lumbering animata cervello corpora quaeritis. Summus thalamus brains sit​​, morbo basal ganglia vel maleficia? De braaaiiiins apocalypsi gorger omero prefrontal cortex <a href="#">undead survivor</a> fornix dictum mauris. Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve, imo evil braaiinns stalking monstra hypothalamus adventus resi hippocampus dentevil.</p>
        </div>
      </section>
      <section id="section3" role="tabpanel" aria-labelledby="tab3" class="tabs-panel js-tabs-panel">
        <div class="accordeon-trigger js-accordeon-trigger" aria-controls="section3" aria-expanded="false" tabindex="0">Section 3 <div class="accordeon-trigger-icon"><span class="label--open">Open</span><span class="label--close">Close</span><svg aria-hidden="true" focusable="false" viewBox="0 0 20 20">
            <rect class="vert" height="18" width="2" fill="currentColor" y="1" x="9"></rect>
            <rect height="2" width="18" fill="currentColor" y="9" x="1"></rect>
          </svg></div></div>
        <div class="content" aria-hidden="true">
          <h2>Headline Section 3</h2>
          <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De <a href="#">carne lumbering animata</a> corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. </p>
        </div>
      </section>
    </section>

Stop playing videos when changing a tab

Hi. Firstly thank you for the great plugin.

There are different types of embedded videos under each tab content including html5 video and youtube iframe.
If one video starts playing it continues playing in the background anyway even if I change a tab.

Could you please advise what would be the best solution in this case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.