Permalink
Browse files

fix(dropdown): Clear leftover active state on menu open (fixes #664)

  • Loading branch information...
tmorehouse committed Jul 7, 2017
1 parent 1de785e commit 80c1cebd001f6c109c386c3589c5fe7b6781dc0f
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/mixins/dropdown.js
@@ -125,8 +125,10 @@ export default {
this.visible = !this.visible;
if (this.visible) {
this.$nextTick(function () {
// Clear any items that may have active state left
this.clearItems();
// Focus first visible non-disabled item
let item = this.getFirstItem();
const item = this.getFirstItem();
if (item) {
this.focusItem(0, [item]);
}
@@ -207,6 +209,12 @@ export default {
}
});
},
clearItems() {
const items = this.getItems();
items.forEach(el => {
el.classList.remove('active');
});
},
getItems() {
// Get all items and headers
return filterVisible(nodeListToArray(this.$refs.menu.querySelectorAll(ALL_SELECTOR)));

0 comments on commit 80c1ceb

Please sign in to comment.