mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 10:15:27 -04:00
fix(ui): add missing Escape key handlers for email-lib-modal, model-picker-menu, and sort dropdowns (#1487)
CONTEXT: Several interactive elements lacked Escape key handlers: the email library modal was not in dynamicModals, the model-picker popup had no Escape close, and the session/model sort dropdowns only closed on outside click. CHANGE: Adds email-lib-modal to the dynamicModals array in the Escape handler so it gets dismissed via dismissModal. Adds a check for model-picker-menu.open before the modal chain to close the dropdown on Escape. Adds checks for session-sort-dropdown and model-sort-dropdown display=block before the document panel minimize fallback. WHY: Users expect consistent Escape-to-close behavior across all modals, overlays, and popups. These four were the only interactive containers in the app that ignored the Escape key entirely. IMPACT: Pressing Escape now closes the email library modal, model picker popup, session sort dropdown, and model sort dropdown -- matching user expectations and the behavior of every other modal in the app.
This commit is contained in:
+8
-1
@@ -532,6 +532,13 @@ function initializeEventListeners() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Model picker popup — close before opening any modals
|
||||||
|
const modelPickerMenu = document.getElementById('model-picker-menu');
|
||||||
|
if (modelPickerMenu && modelPickerMenu.classList.contains('open')) {
|
||||||
|
modelPickerMenu.classList.remove('open');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Close one modal at a time (last in DOM = topmost)
|
// Close one modal at a time (last in DOM = topmost)
|
||||||
// Map modal id → sidebar list-item id to clear active state
|
// Map modal id → sidebar list-item id to clear active state
|
||||||
const modalItemMap = {
|
const modalItemMap = {
|
||||||
@@ -543,7 +550,7 @@ function initializeEventListeners() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Dynamic modals (removed from DOM on close)
|
// Dynamic modals (removed from DOM on close)
|
||||||
const dynamicModals = ['library-modal', 'archive-modal', 'doclib-modal', 'gallery-modal', 'tasks-modal'];
|
const dynamicModals = ['library-modal', 'archive-modal', 'doclib-modal', 'gallery-modal', 'tasks-modal', 'email-lib-modal'];
|
||||||
for (const id of dynamicModals) {
|
for (const id of dynamicModals) {
|
||||||
const m = document.getElementById(id);
|
const m = document.getElementById(id);
|
||||||
if (id === 'gallery-modal') {
|
if (id === 'gallery-modal') {
|
||||||
|
|||||||
Reference in New Issue
Block a user