Giter Club home page Giter Club logo

a11y_accordions's People

Contributors

scottaohara 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  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  avatar  avatar  avatar

a11y_accordions's Issues

Add feature: Heading Nodes vs textContent

Ran into an issue where I needed some SPAN content passed thru to the button text. Ex: a FontAwesome I tag.

In your ARIAaccordion.setupHeadingButton function the following changes did the trick.

// dhj; var buttonText;
var headingNodes;
...
// dhj; buttonText = heading.textContent;
headingNodes = heading.cloneNode(true); // clone the heading contents
// if you waited to delete the heading contents, you can skip the cloning
...
//dhj;  newButton.appendChild(doc.createTextNode(buttonText));
while( headingNodes.childNodes.length > 0 ) {    // loop thru the heading content
  newButton.appendChild(headingNodes.childNodes[0]);  // adding the nodes to the button
}

So, there ya go.
It might be something useful.

Share and enjoy.

dhj

Is there data attribute which closes it's respective panel??

Hi there,
This is not an issue. Rather than clicking the heading to close panel. Is there an attribute which we can attached in button which sit inside it's respective panel and closes it. Still new to JS world so any help will be highly appropriated.

many thanks
Sumanita

How to remove vertical scrollbar on Firefox

First of all thank you for giving us this accordion module, it's very generous of you.

I am testing its operation under different browsers.

In Firefox, when the panel opens I see a vertical scroll bar on the right. Once the panel is open, the bar disappears.

With Safari, Goocle Chrome and Opera this bar does not appear.

My question how to remove this bar in Firefox?

Thanks

OS X : 10.14.5
Safari : 12.1.1
Firefox : 67.0
Firefox Developer Edition : 68.0b5
Google Chrome : 74.0.3729.131
Opera : 60.0.3255.125

firefox-scrollbar

Update focus styles

When focusing an active accordion trigger a unique focus style should be available

This should just require a new css focus selector for the button when in the aria-expanded state

firefox double firing of reveal function

in firefox, when hitting the spacebar on a generated to open/close a panel, the function is firing twice, not allowing a panel to effectively be opened or closed.

this issue only happens in firefox.

Add feature: replace default classes with custom

Add in feature for use of data-class attribute, where the set value will be the baseline class that the accordion wrapper will have applied to it, and child elements will use as it's BEM base.

e.g.
data-class="my-acc"

should produce:
.my-acc
.my-acc__heading
.my-acc__panel
etc.

Possible `id` collision

As written, with multiple accordions, there's a possibility that the same randomly-generated id could be applied to multiple elements.

Might be safer to do something like this toward the top of your closure:

var idCounter = 0;

Then, at the top of Accordion.create() (before the loop starts)

idCounter += 1;

And to generate the actual id per element:

self.id = 'acc_' + idCounter + '-' + i;

This way, since you're auto-incrementing, it impossible to ever have any collisions (until you get to 9007199254740991, which is the maximum safe integer in JS and – you know – probably not gonna be a problem).

Additional optional features

Per the ARIA Authoring Practices, finish work on the optional functionality to allow for up and down arrows to navigate between panel triggers.

This behavior is not typically expected to all screen reader users, and may be confusing if the accordion panels do not contain focusable elements for a user to tab to.

NPM package

Hi there,
it would be helpful to publish this library as a NPM package, so it can be imported and updated easily.

question about 2 lines of text in header area

not sure if this is the place for questions, but I'm trying to get 2 different lines of text in my "header" an h2 and a p.

<li class="accordion-item">
  <img src="<?php the_sub_field('image'); ?>" />
  <h2 class="accordion-heading" data-aria-accordion-heading><?php the_sub_field('title'); ?></h2>
*(Ideally another line of text here)*
  <div class="accordion-panel" data-aria-accordion-panel>
   	<p><?php the_sub_field('main_content'); ?></p>
  </div>
</li>

I've tried inserting it inside the h2, putting it below the h2, adding a div to hold the h2 and the p. those all seem to break the button.
any direction would be awesome!

(you can see it here if you'd like: https://globaltoolkit.wpengine.com/test-page/) down at the bottom.

Originally posted by @RidgeviewTech in #7 (comment)

Open an accordion panel using button

Hello, I have been using your accordion and it's great.
But I have a question.

Inside each panel I have a button that says 'next step'. If it clicked it will open the next panel.

I used jquery to simulate a click on the accordion header (trigger?) when 'next step' is clicked.

It does open the next panel, however the opened panel class is 'was-active', and the previous panel class is still 'is-active'

How can I fix this? sorry if my explanation is confusing. Hope you can help. Thanks!

All headings/panels within nested ol/ul lists get same parent accordion properties

First of all, great job!

The query selector you use for accordion headings/panels contained within an ol/ul list returns all descendant headings/panels in the main accordion (as well as the nested ones).

Currently:
panels = doc.querySelectorAll('#' + self.id + ' li > ' + widgetPanel);
headings = doc.querySelectorAll('#' + self.id + ' li > ' + widgetHeading);

Should be:
panels = doc.querySelectorAll('#' + self.id + ' > li > ' + widgetPanel);
headings = doc.querySelectorAll('#' + self.id + ' > li > ' + widgetHeading);

ARIA 1.1 spec is changing

per w3c aria-practices issue i opened about accordions:
"We are replacing the accordian design pattern with one that does not use the tab or tabpanel roles."

so this will need to change soon

Add feature: heading-less triggers

Accordions should be allowed to be created without the triggers needing to be within heading elements.

This would make far more sense for instances of them being used within list elements.

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.