fix: Disable virtual scroll keyboard navigation when editing content or a modal is open. See #759

This commit is contained in:
Will Miao
2026-01-07 00:01:09 +08:00
parent f199c9b591
commit fd7cb3300d

View File

@@ -149,8 +149,11 @@ function setupKeyboardNavigation() {
// Store the event listener reference so we can remove it later if needed // Store the event listener reference so we can remove it later if needed
const keyboardNavHandler = (event) => { const keyboardNavHandler = (event) => {
// Only handle keyboard events when not in form elements // Only handle keyboard events when not in form elements or contenteditable elements
if (event.target.matches('input, textarea, select')) return; if (event.target.matches('input, textarea, select') || event.target.isContentEditable) return;
// Skip background navigation if a modal is open
if (document.body.classList.contains('modal-open')) return;
// Prevent rapid keypresses // Prevent rapid keypresses
const now = Date.now(); const now = Date.now();