Skip to content

Commit

Permalink
Fixed #2311 - Filtered Dropdown unusable on Windows Tablet
Browse files Browse the repository at this point in the history
  • Loading branch information
mcandu committed Sep 21, 2021
1 parent c820b48 commit 9672a16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ export class Dropdown extends Component {
bindResizeListener() {
if (!this.resizeListener) {
this.resizeListener = () => {
if (this.state.overlayVisible && !DomHandler.isAndroid()) {
if (this.state.overlayVisible && !DomHandler.isTouchDevice()) {
this.hideOverlay();
}
};
Expand Down
4 changes: 4 additions & 0 deletions src/components/utils/DomHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ export default class DomHandler {
return /(android)/i.test(navigator.userAgent);
}

static isTouchDevice() {
return (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
}

static isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/utils/Utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export declare class DomHandler {
static getUserAgent(): string;
static isIOS(): boolean;
static isAndroid(): boolean;
static isTouchDevice(): boolean;
static isFunction(obj: any): boolean;
static appendChild(el: HTMLElement, target: HTMLElement): void;
static removeChild(el: HTMLElement, target: HTMLElement): void;
Expand Down

0 comments on commit 9672a16

Please sign in to comment.