diff --git a/element.js b/element.js index ab74f763..b7628f13 100644 --- a/element.js +++ b/element.js @@ -31,6 +31,14 @@ function buildElement(type, props, ...children) { if (propName === "onClick") { let handler = props[propName]; $el.click(handler); + + // Some passed-in props need to be set with $.attr + // Currently we do this for role and aria-* + } else if (/^aria-/.test(propName) || propName === "role") { + let value = props[propName]; + $el.attr(propName, value); + + // All other props can go right to $.prop } else { let value = props[propName]; $el.prop(propName, value); diff --git a/index.js b/index.js index 60c3018c..98d8ecfc 100644 --- a/index.js +++ b/index.js @@ -82,20 +82,24 @@ class Toolbar { e.preventDefault(); e.stopPropagation(); $toolbar.toggleClass("tota11y-expanded"); + $toolbar.attr("aria-expanded", $toolbar.is(".tota11y-expanded")); }; let $toggle = ( - -
+ ); $toolbar = ( -
+