From: Geoff Kimball Date: Thu, 3 Mar 2016 18:34:36 +0000 (-0800) Subject: Add visual test to verify that accordions work with
  • and data-accordion-item... X-Git-Tag: v6.2.1~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87fe59f19e47e37395a6a4a38aca04e673775ac7;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add visual test to verify that accordions work with
  • and data-accordion-item, and allow the methods to be mixed without breaking, closes #8013 --- diff --git a/js/foundation.accordion.js b/js/foundation.accordion.js index 814a9aca4..4d2396fcb 100644 --- a/js/foundation.accordion.js +++ b/js/foundation.accordion.js @@ -38,12 +38,9 @@ class Accordion { */ _init() { this.$element.attr('role', 'tablist'); - this.$tabs = this.$element.children('li'); - if (this.$tabs.length === 0) { - this.$tabs = this.$element.children('[data-accordion-item]'); - } - this.$tabs.each(function(idx, el){ + this.$tabs = this.$element.children('li, [data-accordion-item]'); + this.$tabs.each(function(idx, el) { var $el = $(el), $content = $el.children('[data-tab-content]'), id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'), @@ -56,6 +53,7 @@ class Accordion { 'aria-expanded': false, 'aria-selected': false }); + $content.attr({'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id}); }); var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); diff --git a/test/visual/accordion/item-attributes.html b/test/visual/accordion/item-attributes.html new file mode 100644 index 000000000..722599779 --- /dev/null +++ b/test/visual/accordion/item-attributes.html @@ -0,0 +1,80 @@ + + + + + + + Foundation for Sites Testing + + + +
    +

    Accordion: Item Attributes

    + +

    Accordion items can be defined as <li>s, or by having the attribute data-accordion-item.

    + +
    + +

    This accordion uses list items and has no attribute.

    + + + +
    + +

    This accordion uses generic tags with an attribute.

    + +
    +
    + Accordion 1 +
    + Item +
    +
    +
    + Accordion 2 +
    + Item +
    +
    +
    + +
    + +

    This accordion mixes both methods.

    + +
    +
  • + Accordion 1 +
    + Item +
    +
  • +
    + Accordion 2 +
    + Item +
    +
    + + + + + + + +