2
0
Эх сурвалжийг харах

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

Xavi Ferrer 4 жил өмнө
parent
commit
cc458e8d3b

+ 1 - 1
src/components/dropdown.js

@@ -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 () {