diff --git a/src/App.tsx b/src/App.tsx index 1321568..2e42193 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1151,11 +1151,17 @@ function App() { {isAddModalOpen && } - - {selectedPropertiesDownloadId !== null && } - {isDeleteModalOpen && } - {showKeychainModal && } - + {selectedPropertiesDownloadId !== null && ( + + + + )} + {isDeleteModalOpen && ( + + + + )} + {showKeychainModal && } ); diff --git a/src/components/AddDownloadsModal.tsx b/src/components/AddDownloadsModal.tsx index e2c0378..a167bdf 100644 --- a/src/components/AddDownloadsModal.tsx +++ b/src/components/AddDownloadsModal.tsx @@ -50,6 +50,7 @@ import { type AddDownloadDraftRow, type MediaSelection } from '../utils/addDownloadMetadata'; +import { isTopmostModal, useModalFocus } from '../hooks/useModalFocus'; const formatBytes = (bytes: number) => { const k = 1024; @@ -165,6 +166,7 @@ export const AddDownloadsModal = () => { const [conflicts, setConflicts] = useState([]); const [showingDuplicates, setShowingDuplicates] = useState(false); + const modalRef = useModalFocus(isAddModalOpen); const [pendingAction, setPendingAction] = useState({ type: 'start-now' }); const [pendingUseSharedDestination, setPendingUseSharedDestination] = useState(false); const [pendingDestinationOverrides, setPendingDestinationOverrides] = useState>({}); @@ -363,7 +365,9 @@ export const AddDownloadsModal = () => { if (!isAddModalOpen) return; const closeOnEscape = (event: KeyboardEvent) => { if (event.key !== 'Escape') return; + if (!isTopmostModal(modalRef.current)) return; if (showKeychainModal) return; + event.preventDefault(); if (showingDuplicates) { setShowingDuplicates(false); } else if (isQueueMenuOpen) { @@ -1583,8 +1587,14 @@ export const AddDownloadsModal = () => { }} role="dialog" aria-modal="true" + aria-labelledby="add-downloads-modal-title" > -
+
{/* Main Content Split */}
@@ -1597,7 +1607,7 @@ export const AddDownloadsModal = () => {
- {t($ => $.addDownloads.downloadLinks)} + {t($ => $.addDownloads.downloadLinks)}