From 2b5bfebf3cf990182810b6a93b9afd8807a309de Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 6 Nov 2018 17:16:22 +0000 Subject: [PATCH] Prevent software keyboard popping up again in Android Chrome. --- src/components/Output/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/Output/index.tsx b/src/components/Output/index.tsx index 5a80939b..a78d01e1 100644 --- a/src/components/Output/index.tsx +++ b/src/components/Output/index.tsx @@ -177,6 +177,17 @@ export default class Output extends Component { const clonedEvent = new (event.constructor as typeof Event)(event.type, event); this.retargetedEvents.add(clonedEvent); this.pinchZoomLeft.dispatchEvent(clonedEvent); + + // Unfocus any active element on touchend. This fixes an issue on (at least) Android Chrome, + // where the software keyboard is hidden, but the input remains focused, then after interaction + // with this element the keyboard reappears for NO GOOD REASON. Thanks Android. + if ( + event.type === 'touchend' && + document.activeElement && + document.activeElement instanceof HTMLElement + ) { + document.activeElement.blur(); + } } render(