Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accordion]: Accordions should not treat every button as a toggle #1338

Closed
humancompanion opened this issue Jul 19, 2016 · 1 comment
Closed
Labels
Type: Enhancement An improvement to existing code

Comments

@humancompanion
Copy link

Description

Currently, the accordion.js file treats any button it finds inside of .usa-accordion as a toggle for that accordion.

this.$('button').each(function () {...

This creates a few inconveniences:

  1. All buttons, at any level, inside of the accordion will toggle the accordion and are treated as a drawer face (for lack of a better term). Thus using another button inside of the accordion that should not act as a toggle isn't possible. For example, if I have a form inside of an accordion the buttons associated with the form will toggle the accordion.
  2. Using another element to toggle the accordion is not possible. If I want to use another HTML element to trigger the accordion I cannot. Or more to the point if I want to have an additional element trigger the accordion to close I'd need to write additional JS code to trigger the close.
  3. If I nest an accordion, or more commonly a drawer of my own making inside an accordion, then again any button I use inside the drawer may inadvertently trigger the accordion.

Ideally, the JS code would look for a data attribute, or failing that a specific class name, that establishes the element as a toggle for the accordion. Perhaps we are abusing the accordion component by using it in a way that it wasn't intended to be used. In that case, we'd love a drawer component. :-)

As a side note, the .usa-unstyled-list class that is often added to the unordered list element that houses an accordion also applies it styles a bit too widely. .usa-unstyled-list li::before removes the bullet from all lists at any level that appear within rather than just first level of list items (i.e. .usa-unstyled-list > li::before. Thus any unordered list that appears inside an accordion's content loses the list item bullets.

@juliaelman juliaelman added Type: Enhancement An improvement to existing code [Status] Backlog labels Jul 19, 2016
@juliaelman
Copy link
Contributor

Thank you for your interest and contributing to the Draft U.S. Web Design Standards! We have received notification of your contribution and are currently triaging the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement An improvement to existing code
Projects
None yet
Development

No branches or pull requests

3 participants