Skip to content

Commit 40ee1a9

Browse files
committed
feat: add hack for android issue with the keyboard opening over inputs
1 parent 447b16b commit 40ee1a9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app-src/scripts/_app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
.run(checkIfLatestVersion)
5454
.run(showWelcomeDialog)
5555
.run(initUnloadActions)
56+
.run(initInputFocusFixForAndroid)
5657
.run(initElectronOnBeforeQuit);
5758

5859
/* @ngInject */
@@ -427,4 +428,19 @@
427428
};
428429
}
429430

431+
function initInputFocusFixForAndroid() {
432+
// dirty hack to fix inputs not being visible when the keyboard open
433+
if (/Android/.test(navigator.appVersion)) {
434+
window.addEventListener('resize', function() {
435+
if (document.activeElement.tagName === 'INPUT' ||
436+
document.activeElement.tagName === 'TEXTAREA' ||
437+
document.activeElement.getAttribute('contenteditable')) {
438+
window.setTimeout(function() {
439+
document.activeElement.scrollIntoViewIfNeeded();
440+
}, 0);
441+
}
442+
});
443+
}
444+
}
445+
430446
})();

0 commit comments

Comments
 (0)