From 45b5121066035127dbb3a0aa7b889454c3e75a9e Mon Sep 17 00:00:00 2001 From: Yves Gatesoupe Date: Thu, 24 Mar 2016 15:27:06 +0100 Subject: [PATCH 1/2] fix(component): dropdown remove li and a tag in selectors, only class names focus first item in menu after open add roles on dropdown on document ready --- js/src/dropdown.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 36cd002573..38116ef6ea 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -47,6 +47,9 @@ const Dropdown = (($) => { ROLE_MENU : '[role="menu"]', ROLE_LISTBOX : '[role="listbox"]', NAVBAR_NAV : '.navbar-nav', + // Boosted mod + FIRST_ITEM_IN_MENU : '.dropdown-menu .dropdown-item:not(.disabled)', + // end mod VISIBLE_ITEMS : '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a' } @@ -63,6 +66,11 @@ const Dropdown = (($) => { constructor(element) { this._element = element + // Boosted mod + console.log('lol') + this._addAria(this._element) + // end mod + this._addEventListeners() } @@ -108,14 +116,19 @@ const Dropdown = (($) => { if (showEvent.isDefaultPrevented()) { return false } + // Boosted mod // this.focus() - $(parent).find('.dropdown-menu li:not(.disabled) a:not(.disabled)').first().trigger('focus') // end mod this.setAttribute('aria-expanded', 'true') $(parent).toggleClass(ClassName.OPEN) $(parent).trigger($.Event(Event.SHOWN, relatedTarget)) + + // Boosted mod + $(parent).find(Selector.FIRST_ITEM_IN_MENU).first().focus() + // end mod + return false } @@ -263,7 +276,7 @@ const Dropdown = (($) => { // set default acessibility Attributes $(document).ready(($) => { $('.dropdown-menu').attr('role', 'menu') - $('.dropdown-menu a.dropdown-item').attr('role', 'menuitem') + $('.dropdown-menu .dropdown-item').attr('role', 'menuitem') }) // end mod /** From 472693e8ccfadd18416f54e79fc3dc0172bb9e31 Mon Sep 17 00:00:00 2001 From: Yves Gatesoupe Date: Thu, 24 Mar 2016 15:52:20 +0100 Subject: [PATCH 2/2] fix(test): megamenu visual updated html and assets paths --- js/tests/visual/megamenu.html | 436 ++++++++++++---------------------- 1 file changed, 153 insertions(+), 283 deletions(-) diff --git a/js/tests/visual/megamenu.html b/js/tests/visual/megamenu.html index 3eb2b046a9..81c6aef2cd 100644 --- a/js/tests/visual/megamenu.html +++ b/js/tests/visual/megamenu.html @@ -5,296 +5,166 @@ Megamenu - + - + -
- -
-
- + + -
+ +
+
+
+ + + +
+
+
- - - + - + + + + + \ No newline at end of file