From 553419126869d591b17722fe15fb215c4e82d345 Mon Sep 17 00:00:00 2001 From: Lukas Date: Sun, 28 Jun 2026 17:39:59 +0200 Subject: [PATCH] Add Escape key to close settings modal --- Docs/tasks.md | 16 ---------------- src/server/web/static/js/app.js | 9 ++++++++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Docs/tasks.md b/Docs/tasks.md index dc54375..0e13eb0 100644 --- a/Docs/tasks.md +++ b/Docs/tasks.md @@ -1,19 +1,3 @@ -## Task 17: UI Settings Modal - Close Settings Modal Via Overlay - -**Suite:** `Robot.Ui.Settings Modal` -**Test:** `Close Settings Modal Via Overlay` -**Result:** FAIL -**Error:** `TimeoutError: locator.click: Timeout 10000ms exceeded. waiting for locator('id=config-modal .modal-overlay')` - -**Instructions:** -- The test tries to click a `.modal-overlay` element inside `#config-modal`, but the element is not found. -- Inspect the settings modal HTML structure in the frontend. -- The overlay element may have a different class name (e.g., `.modal-backdrop`, `.overlay`) or may not exist as a separate element. -- Update the locator in `tests/robot/ui/settings_modal.robot` to match the actual DOM structure. -- If the overlay click-to-close behavior is missing, implement it in the frontend. - ---- - ## Task 18: UI Settings Modal - Close Settings Modal Via Escape **Suite:** `Robot.Ui.Settings Modal` diff --git a/src/server/web/static/js/app.js b/src/server/web/static/js/app.js index 482f2e3..843cd83 100644 --- a/src/server/web/static/js/app.js +++ b/src/server/web/static/js/app.js @@ -442,7 +442,14 @@ class AniWorldApp { this.hideConfigModal(); }); - // Scheduler configuration + document.addEventListener('keydown', (e) => { + const modal = document.getElementById('config-modal'); + if (e.key === 'Escape' && modal && !modal.classList.contains('hidden')) { + this.hideConfigModal(); + } + }); + + // Scheduler configuration document.getElementById('scheduled-rescan-enabled').addEventListener('change', () => { this.toggleSchedulerTimeInput(); });