From b4292dcd851fbedcea3a251a1be1127763a045aa Mon Sep 17 00:00:00 2001 From: daria Date: Tue, 3 Dec 2024 12:04:43 +0200 Subject: [PATCH] disable arrow keys while a modal is opened #1660 --- www/common/drive-ui.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 28003d446..4b2d2b119 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1045,9 +1045,7 @@ define([ // If the arrow keys aren't caught by another listener before, it means we can // use them to select content in the drive. If that's the case, we'll also // focus the drive container to avoid conflicts with other focused elements - if (!$('.cp-modal').is(':visible')) { - $content.focus(); - } + $content.focus(); var click = function (el) { if (!el) { return; } @@ -1062,6 +1060,11 @@ define([ $elements.index($selection.last()[0]); var length = $elements.length; if (length === 0) { return; } + + if ($('.cp-modal').is(':visible')) { + return; + } + // List mode if (getViewMode() === "list") { if (e.which === 40) { click($elements.get(Math.min(lastIndex+1, length -1))); }