use composedPath() instead as it is standarized and cross-browser suported
This commit is contained in:
parent
37662e8dc1
commit
cc458e8d3b
@ -15,7 +15,7 @@ export class BaseDropdown extends CustomElement {
|
|||||||
this.button = this.dropdown.querySelector('button');
|
this.button = this.dropdown.querySelector('button');
|
||||||
this.dropdown.addEventListener('click', ev => this.toggleMenu(ev));
|
this.dropdown.addEventListener('click', ev => this.toggleMenu(ev));
|
||||||
this.dropdown.addEventListener('keyup', ev => this.handleKeyUp(ev));
|
this.dropdown.addEventListener('keyup', ev => this.handleKeyUp(ev));
|
||||||
document.addEventListener('click', ev => !this.contains(ev.originalTarget || ev.path[0]) && this.hideMenu(ev));
|
document.addEventListener('click', ev => !this.contains(ev.composedPath()[0]) && this.hideMenu(ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
hideMenu () {
|
hideMenu () {
|
||||||
|
Loading…
Reference in New Issue
Block a user