matthiasott / a11y-accordion-tabs Goto Github PK
View Code? Open in Web Editor NEWA script for an accessible accordion tabs component
License: MIT License
A script for an accessible accordion tabs component
License: MIT License
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?
I'm just curious if there are any specific accessibility benefits to your script over something like this:
https://codepen.io/impressivewebs/pen/qBNqGbE
Which I created a short while back and which doesn't use any JS. It seems like it basically works the same way with the keyboard navigation...?
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.
// Expose as a CJS module
if (typeof module === "object" && module.exports) {
module.exports = _;
}
In documentation and in the library itself, accordion is misspelled as accordeon in class names accordeon-trigger js-accordeon-trigger
Is there an intentional reason for this?
I have multiple accordions on the same page. If one of them has data-default attribute set, so that the first item in it auto opens, all subsequent accordions will also show the same behavior, even if the data-default attribute is not present on them.
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>
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!
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?
We can easily achieve the same functionality with only HTML / CSS :
https://codepen.io/sebilasse/pen/qjxQjp
But how about a11y then ?
Most important : Happy holidays ! 🎄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.