mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 18:22:53 +00:00
enhancement: Removes the focus of the first item in the dropdown when it is active. (#2833)
This commit is contained in:
@@ -25,9 +25,6 @@ export default {
|
|||||||
default: 'top',
|
default: 'top',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.focusItem();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
dropdownMenuButtons() {
|
dropdownMenuButtons() {
|
||||||
return this.$refs.dropdownMenu.querySelectorAll(
|
return this.$refs.dropdownMenu.querySelectorAll(
|
||||||
@@ -42,13 +39,6 @@ export default {
|
|||||||
const activeIndex = [...menuButtons].indexOf(focusedButton);
|
const activeIndex = [...menuButtons].indexOf(focusedButton);
|
||||||
return activeIndex;
|
return activeIndex;
|
||||||
},
|
},
|
||||||
focusItem() {
|
|
||||||
const firstButton = this.$refs.dropdownMenu.querySelector(
|
|
||||||
'ul.dropdown li.dropdown-menu__item .button'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (firstButton) firstButton.focus();
|
|
||||||
},
|
|
||||||
handleKeyEvents(e) {
|
handleKeyEvents(e) {
|
||||||
const menuButtons = this.dropdownMenuButtons();
|
const menuButtons = this.dropdownMenuButtons();
|
||||||
const lastElementIndex = menuButtons.length - 1;
|
const lastElementIndex = menuButtons.length - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user