From a706380bbaeb53b83c0e822ddee621cf41953d0a Mon Sep 17 00:00:00 2001 From: FabriceKurmann Date: Tue, 2 Jul 2024 18:05:30 -0700 Subject: [PATCH] Addressing PR comments. --- static/js/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 525fec3..f27d005 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -187,7 +187,7 @@ function initVideo(info) { `; - removeKeydownSideEffects(); + removeHotkeysOnText(); } function toggleSelection() { @@ -258,7 +258,7 @@ function addScreenshot(screenshot) { document.querySelector('.screenshot-area').insertAdjacentHTML('afterbegin', html); - removeKeydownSideEffects(); + removeHotkeysOnText(); } // Flip a screenshot by adding it the the canvas flipped horizontally or vertically. @@ -466,9 +466,11 @@ function initializeHotkeys() { save(); } }); + + removeHotkeysOnText(); } -function removeKeydownSideEffects() { +function removeHotkeysOnText() { document.querySelectorAll('input[type="text"]').forEach((input) => { input.setAttribute('onkeydown', 'event.stopPropagation()'); }); @@ -477,7 +479,6 @@ function removeKeydownSideEffects() { function main() { fetchVersion(); initializeHotkeys(); - removeKeydownSideEffects(); goToUploadScreen(); }