From aa8c9f3b0633c29478447cfbcfc9fc79263229ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sur=C3=A1nyi=20G=C3=A1bor?= Date: Tue, 5 Apr 2022 15:06:14 +0200 Subject: [PATCH] Fix the autofocus behavior In some cases autofocus don't work as expected because of wrong padding top. This change fix this issue. --- src/kioskboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kioskboard.js b/src/kioskboard.js index 8f06db5..6a641f1 100644 --- a/src/kioskboard.js +++ b/src/kioskboard.js @@ -736,7 +736,7 @@ var docTop = window.document.documentElement.scrollTop || 0; var inputThreshold = isPlacementTop ? (theInput.clientHeight + 20) : 50; var theInputOffsetTop = Math.round(inputTop + docTop) - inputThreshold; - var isPaddingTop = theInputOffsetTop < keyboardHeight; + var isPaddingTop = (theInputOffsetTop < keyboardHeight) && isPlacementTop; var isPaddingBottom = documentHeight <= (theInputOffsetTop + keyboardHeight); if (isPaddingTop || isPaddingBottom) {