diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index 77f1f1c4..5a5fafd8 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -83,7 +83,7 @@ window.baguetteBox = (function () { var trapFocusInsideOverlay = function (event) { if (overlay.style.display === 'block' && (overlay.contains && !overlay.contains(event.target))) { event.stopPropagation(); - initFocus(); + closeButton.focus(); } }; @@ -378,18 +378,10 @@ window.baguetteBox = (function () { options.onChange(currentIndex, imagesElements.length); } documentLastFocus = document.activeElement; - initFocus(); + closeButton.focus(); isOverlayVisible = true; } - function initFocus() { - if (options.buttons) { - previousButton.focus(); - } else { - closeButton.focus(); - } - } - function hideOverlay(e) { ev(e); playvid(false); diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index a11c05cb..1f4148d4 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1756,6 +1756,9 @@ document.onkeydown = function (e) { if (e.ctrlKey || e.altKey || e.metaKey || e.isComposing) return; + if (QS('#baguetteBox-overlay.visible')) + return; + var k = e.code + '', pos = -1, n; if (e.shiftKey && k != 'KeyA' && k != 'KeyD')