enhancement: Removes the focus of the first item in the dropdown when it is active. (#2833)

This commit is contained in:
Sivin Varghese 2021-08-16 22:11:20 +05:30 committed by GitHub
parent 70d41ffcdd
commit 0e4196c91a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,9 +25,6 @@ export default {
default: 'top',
},
},
mounted() {
this.focusItem();
},
methods: {
dropdownMenuButtons() {
return this.$refs.dropdownMenu.querySelectorAll(
@ -42,13 +39,6 @@ export default {
const activeIndex = [...menuButtons].indexOf(focusedButton);
return activeIndex;
},
focusItem() {
const firstButton = this.$refs.dropdownMenu.querySelector(
'ul.dropdown li.dropdown-menu__item .button'
);
if (firstButton) firstButton.focus();
},
handleKeyEvents(e) {
const menuButtons = this.dropdownMenuButtons();
const lastElementIndex = menuButtons.length - 1;