fix(dashboard): stop Files-tab shortcuts from firing behind the share modal

The document-level keydown.tabfiles handler kept running while the
share (or item-properties) modal was open. With focus on any of the
modal's buttons or selects, Enter and Space were preventDefault-ed
before they could activate the control, arrows could not drive the
mode selects, and letter typeahead was hijacked into row typesearch —
while Enter opened the selected row behind the overlay, Delete moved
it to Trash, and Cmd+A/C/X/V acted on the hidden list. Yield the
keyboard to the modal for as long as one is up; its own handlers
already cover Escape and Tab.
This commit is contained in:
Nariman Jelveh
2026-08-17 22:16:39 -07:00
parent 4ec5620eef
commit b0ac4f1038
+6
View File
@@ -664,6 +664,12 @@ const TabFiles = {
// Only handle if Dashboard Files tab is active
if ( ! _this.isDashboardFilesActive() ) return;
// A Files-tab modal (share, item properties) owns the keyboard
// while open: Enter/Space must reach its buttons, arrows its
// selects, and typing must not retarget row selection — nor may
// Enter/Delete open or trash the rows behind the overlay.
if ( $('.share-modal-overlay, .item-props-overlay').length > 0 ) return;
const focused_el = document.activeElement;
// Skip if user is typing in an input/textarea (except for Escape)