Skip to content

Commit

Permalink
Use context properties
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit2sharma95 authored and XhmikosR committed Apr 18, 2021
1 parent 38a79ec commit bce4684
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/src/dropdown.js
Expand Up @@ -428,13 +428,12 @@ class Dropdown extends BaseComponent {
continue
}

const dropdownMenu = context._menu
if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) {
if (!context._element.classList.contains(CLASS_NAME_SHOW)) {
continue
}

const relatedTarget = {
relatedTarget: toggles[i]
relatedTarget: context._element
}

if (event) {
Expand All @@ -444,7 +443,7 @@ class Dropdown extends BaseComponent {
}

// Tab navigation through the dropdown menu shouldn't close the menu
if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) {
if (event.type === 'keyup' && event.key === TAB_KEY && context._menu.contains(event.target)) {
continue
}

Expand Down

0 comments on commit bce4684

Please sign in to comment.