From b10b1b2471536eaf6c22d1469c6d099f9824ccf0 Mon Sep 17 00:00:00 2001 From: elisabeth Date: Mon, 5 Dec 2022 15:52:10 +0100 Subject: [PATCH 1/3] Fix: #114 Lighthouse warning 'Does not use passive listeners to improve scrolling performance'. --- src/bootstrap-input-spinner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap-input-spinner.js b/src/bootstrap-input-spinner.js index 8aa9088..8e9c153 100644 --- a/src/bootstrap-input-spinner.js +++ b/src/bootstrap-input-spinner.js @@ -328,7 +328,7 @@ }) element.addEventListener("touchend", function (e) { callback(e) - }) + }, {passive: true}) element.addEventListener("keyup", function (e) { if ((e.keyCode === 32 || e.keyCode === 13)) { triggerKeyPressed = false @@ -349,7 +349,7 @@ e.preventDefault() } callback(e) - }) + }, {passive: true}) element.addEventListener("keydown", function (e) { if ((e.keyCode === 32 || e.keyCode === 13) && !triggerKeyPressed) { triggerKeyPressed = true From 6845ad8830f86b859ff276193bdbd7539d026998 Mon Sep 17 00:00:00 2001 From: Natalia Date: Fri, 3 Mar 2023 15:53:05 +0100 Subject: [PATCH 2/3] Fix passive listeners on touchstart event --- src/bootstrap-input-spinner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap-input-spinner.js b/src/bootstrap-input-spinner.js index 8e9c153..508dba8 100644 --- a/src/bootstrap-input-spinner.js +++ b/src/bootstrap-input-spinner.js @@ -349,7 +349,7 @@ e.preventDefault() } callback(e) - }, {passive: true}) + }, {passive: false}) element.addEventListener("keydown", function (e) { if ((e.keyCode === 32 || e.keyCode === 13) && !triggerKeyPressed) { triggerKeyPressed = true From 1de2080c64ace36372d1a30e70f74941374193e4 Mon Sep 17 00:00:00 2001 From: Natalia Date: Fri, 14 Jun 2024 18:34:31 +0200 Subject: [PATCH 3/3] Fix blocking buttons click on mobile scroll --- src/bootstrap-input-spinner.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bootstrap-input-spinner.js b/src/bootstrap-input-spinner.js index 508dba8..585b1b1 100644 --- a/src/bootstrap-input-spinner.js +++ b/src/bootstrap-input-spinner.js @@ -192,7 +192,11 @@ stepHandling(step) } }) - onPointerUp(document.body, function () { + onPointerUp($buttonDecrement[0], function () { + resetTimer() + dispatchEvent($original, "change") + }) + onPointerUp($buttonIncrement[0], function () { resetTimer() dispatchEvent($original, "change") })