Skip to content

Commit

Permalink
Merge branch 'local-v4-dev' into v4-dev
Browse files Browse the repository at this point in the history
Conflicts:
	js/tests/visual/megamenu.html
  • Loading branch information
ygatesoupe committed Mar 24, 2016
2 parents 1b85662 + 472693e commit bedf87d
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 285 deletions.
17 changes: 15 additions & 2 deletions js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -63,6 +66,11 @@ const Dropdown = (($) => {
constructor(element) {
this._element = element

// Boosted mod
console.log('lol')
this._addAria(this._element)
// end mod

this._addEventListeners()
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
/**
Expand Down
Loading

0 comments on commit bedf87d

Please sign in to comment.