accessible-submenu
Advanced tools
Comparing version
{ | ||
"name": "accessible-submenu", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Make your dropdown menus accessible", | ||
@@ -5,0 +5,0 @@ "main": "dist/accessible-submenu.js", |
@@ -44,3 +44,3 @@ # Accessible Submenus | ||
<a href="http://google.com">Top search engine</a> | ||
<a href="#" class="js-submenu-expand">Expand to see more search engines</a> | ||
<button class="js-submenu-expand">Expand to see more search engines</button> | ||
<ul class="js-submenu"> | ||
@@ -60,3 +60,3 @@ <li><a href="http://msn.com">MSN</a></li> | ||
<a href="http://google.com">Top search engine</a> | ||
<a role="button" href="#" aria-expanded="false" class="js-submenu-expand">Expand Menu</a> | ||
<button aria-expanded="false" class="js-submenu-expand">Expand to see more search engines</button> | ||
<ul id="js-submenu-8j6kl" class="js-submenu"> | ||
@@ -84,3 +84,3 @@ <li><a href="http://msn.com">MSN</a></li> | ||
<a href="http://google.com">Top search engine</a> | ||
<a role="button" href="#" aria-expanded="true" aria-controls="sub-menu-8j6kl" class="js-submenu-expand">Expand Menu</a> | ||
<button aria-expanded="true" aria-controls="sub-menu-8j6kl" class="js-submenu-expand">Expand to see more search engines</button> | ||
<ul id="js-submenu-8j6kl" class="js-submenu"> | ||
@@ -124,3 +124,3 @@ <li><a href="http://msn.com">MSN</a></li> | ||
// apple aria-current="page" to links that point to the current page | ||
applyAriaCurrent: true, | ||
applyAriaCurrent: true, | ||
@@ -127,0 +127,0 @@ // whether or not to close on tab out |
@@ -50,3 +50,3 @@ // expandableMenus.js | ||
this.options = extend(defaults, opts, true); | ||
this.dom = { | ||
@@ -81,3 +81,2 @@ el, | ||
this.dom.button.setAttribute('aria-expanded', false); | ||
this.dom.button.href = `#${this.id}`; | ||
if (!this.dom.submenu.id) { | ||
@@ -99,4 +98,2 @@ this.dom.submenu.id = this.id; | ||
if (event.keyCode === keys.space) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
this.toggleOpenClose(); | ||
@@ -181,7 +178,7 @@ } | ||
if (this.options.closeOnTabOut) { | ||
if (this.options.closeOnTabOut) { | ||
document.removeEventListener('keyup', this.handleBlur.bind(this)); | ||
} | ||
// callback if provided | ||
// callback if provided | ||
if (typeof this.options.onClose === 'function') { | ||
@@ -209,3 +206,3 @@ this.options.onClose(this); | ||
} | ||
// @todo fill out | ||
@@ -218,2 +215,2 @@ destroy() { | ||
export default AccessibleSubmenu; | ||
export default AccessibleSubmenu; |
Sorry, the diff of this file is not supported yet
153489
-0.07%718
-0.28%