use composedPath() instead as it is standarized and cross-browser suported

This commit is contained in:
Xavi Ferrer 2020-09-07 12:14:09 +02:00 committed by JC Brand
parent 37662e8dc1
commit cc458e8d3b

View File

@ -15,7 +15,7 @@ export class BaseDropdown extends CustomElement {
this.button = this.dropdown.querySelector('button');
this.dropdown.addEventListener('click', ev => this.toggleMenu(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 () {