diff --git a/src/components/dropdown/Dropdown.vue b/src/components/dropdown/Dropdown.vue index 6e1b6a87e..6890bcf48 100755 --- a/src/components/dropdown/Dropdown.vue +++ b/src/components/dropdown/Dropdown.vue @@ -512,7 +512,7 @@ export default { bindResizeListener() { if (!this.resizeListener) { this.resizeListener = () => { - if (this.overlayVisible && !DomHandler.isAndroid()) { + if (this.overlayVisible && !DomHandler.isTouchDevice()) { this.hide(); } }; diff --git a/src/components/utils/DomHandler.js b/src/components/utils/DomHandler.js index a86eaefdd..bfecd3d0e 100755 --- a/src/components/utils/DomHandler.js +++ b/src/components/utils/DomHandler.js @@ -140,7 +140,7 @@ export default class DomHandler { else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); } - + return false; } @@ -499,4 +499,8 @@ export default class DomHandler { static isAndroid() { return /(android)/i.test(navigator.userAgent); } + + static isTouchDevice() { + return (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); + } }