From d5a321af165b7cb3eac009603e2eab2e24995467 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 13 Dec 2023 14:25:48 +0100 Subject: [PATCH] Fix keydown event conflict between dropdown and drive --- www/common/common-ui-elements.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 7b2798d46..65f28c0c6 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1758,6 +1758,8 @@ define([ return $($all.get(next)); }; $container.keydown(function (e) { + e.stopPropagation(); // don't propagate event to window if the dropdown is focused + var visible = $innerblock.is(':visible'); var $value = $innerblock.find('li:focus'); if (!visible && [38,40].includes(e.which) && !config.isSelect) { @@ -1767,7 +1769,6 @@ define([ if (!visible) { return; } if (e.which === 38) { // Up e.preventDefault(); - e.stopPropagation(); var $prev; if (!$value.length) { $prev = getAll().last(); @@ -1782,7 +1783,6 @@ define([ } if (e.which === 40) { // Down e.preventDefault(); - e.stopPropagation(); var $next; if (!$value.length) { $next = getAll().first(); @@ -1797,7 +1797,6 @@ define([ } if (e.which === 13 || e.which === 32) { //Enter or space e.preventDefault(); - e.stopPropagation(); if ($value.length) { $value.click(); hide(); @@ -1808,12 +1807,11 @@ define([ } if (e.which === 27) { // Esc e.preventDefault(); - e.stopPropagation(); $value.mouseleave(); hide(); $button.focus(); } - if (e.which === 9) { + if (e.which === 9) { // Tab hide(); if (e.shiftKey) { $button.focus(); @@ -1823,6 +1821,7 @@ define([ } }); $container.keypress(function (e) { + e.stopPropagation(); // Don't propagate to window window.clearTimeout(to); var c = String.fromCharCode(e.which); pressed += c;