Agent Zero AI framework
Fix mobile modal layering over canvas rail
Alessandro8bcf1d3165d5
diff --git a/tests/test_browser_agent_regressions.py b/tests/test_browser_agent_regressions.pyindex 094f9fb3e..6c076c42d 100644--- a/tests/test_browser_agent_regressions.py+++ b/tests/test_browser_agent_regressions.py@@ -898,6 +898,24 @@ def test_surface_buttons_keep_modal_and_canvas_entry_points_separate():assert "&& !modalRequiresExplicitClose(newModal)" in modals_jsassert "if (modalRequiresExplicitClose(modalStack[modalStack.length - 1])) return;" in modals_jsassert ".modal-surface-switcher" not in modals_css++ modal_stack_z = int(re.search(r"const baseZIndex = (\d+);", modals_js).group(1))+ modal_css_z = int(re.search(r"\.modal \{[^}]*z-index: (\d+);", modals_css, re.S).group(1))+ legacy_overlay_z = int(re.search(r"\.modal-overlay \{[^}]*z-index: (\d+);", modals_css, re.S).group(1))+ mobile_canvas_z = int(+ re.search(+ r"body\.right-canvas-mobile-mode \.right-canvas \{[^}]*z-index: (\d+);",+ canvas_css,+ re.S,+ ).group(1)+ )+ assert mobile_canvas_z == 3400+ assert modal_stack_z > mobile_canvas_z+ assert modal_css_z > mobile_canvas_z+ assert legacy_overlay_z > mobile_canvas_z+ assert "@media (max-width: 420px)" in canvas_css+ assert "body.right-canvas-mobile-mode .right-canvas-rail {\n gap: 5px;" in canvas_css+ assert "transform: translateY(-50%) scale(0.92);" in canvas_cssassert ".surface-switcher" in surfaces_cssassert ".surface-button" in surfaces_cssassert ".modal-surface-button.is-active" in surfaces_cssdiff --git a/webui/components/canvas/AGENTS.md b/webui/components/canvas/AGENTS.mdindex 7e9d61f6b..c0548378d 100644--- a/webui/components/canvas/AGENTS.md+++ b/webui/components/canvas/AGENTS.md@@ -15,6 +15,7 @@- Keep registered surfaces compatible with WebUI extension hooks.- Preserve responsive layout and avoid overlapping the chat/sidebar shells.- Right-canvas rail and tab buttons are explicit canvas entry points above the mobile breakpoint; at mobile widths, keep the rail visible but route non-action surfaces into floating modals instead of the side canvas shell.+- In mobile mode, keep the rail below blocking modal layers and compact it on very narrow screens instead of letting it cover modal content.## Work Guidancediff --git a/webui/components/canvas/right-canvas.css b/webui/components/canvas/right-canvas.cssindex db2ac6099..cce36b6fd 100644--- a/webui/components/canvas/right-canvas.css+++ b/webui/components/canvas/right-canvas.css@@ -354,6 +354,29 @@ body.right-canvas-mobile-mode .right-canvas-resize-handle {display: none !important;}+@media (max-width: 420px) {+ body.right-canvas-mobile-mode .right-canvas-rail {+ gap: 5px;+ padding: 8px 6px;+ transform: translateY(-50%) scale(0.92);+ transform-origin: right center;+ box-shadow: -8px 0 24px rgba(0, 0, 0, 0.22);+ }++ body.right-canvas-mobile-mode .right-canvas-rail-button,+ body.right-canvas-mobile-mode .right-canvas-icon-button {+ width: 32px;+ height: 32px;+ min-width: 32px;+ min-height: 32px;+ }++ body.right-canvas-mobile-mode .right-canvas-rail-button .material-symbols-outlined,+ body.right-canvas-mobile-mode .right-canvas-icon-button .material-symbols-outlined {+ font-size: 18px;+ }+}+@media (max-width: 480px) {.right-canvas-tab-label {display: none;diff --git a/webui/css/AGENTS.md b/webui/css/AGENTS.mdindex 40ad1903e..b6bf4b1d6 100644--- a/webui/css/AGENTS.md+++ b/webui/css/AGENTS.md@@ -25,6 +25,7 @@- Tall modal bodies must scroll inside `.modal-scroll`; pinned footer content must stay outside that scroll area.- `.modal-floating` must keep the full-screen shell pointer-transparent while `.modal-inner` remains pointer-active.- Use `.modal-no-backdrop` only for backdrop suppression without click-through floating behavior.+- Shared modal layers must stay above the mobile right-canvas rail while confirmation dialogs remain above normal modals.- Do not add decorative one-note palette changes that conflict with existing WebUI design.## Work Guidancediff --git a/webui/css/modals.css b/webui/css/modals.cssindex b72d338ef..d1ef36ec7 100644--- a/webui/css/modals.css+++ b/webui/css/modals.css@@ -12,7 +12,7 @@ the old and the new system. */left: 0;width: 100%;height: 100%;- z-index: 2000;+ z-index: 5000;}.modal.show {display: block;@@ -49,7 +49,7 @@ the old and the new system. */display: flex;align-items: center;justify-content: center;- z-index: 2001;+ z-index: 5001;}/* Modal Backdrop */diff --git a/webui/js/AGENTS.md b/webui/js/AGENTS.mdindex f018caeb0..e3f3e99fd 100644--- a/webui/js/AGENTS.md+++ b/webui/js/AGENTS.md@@ -47,6 +47,7 @@- Check plugin extension callers before changing shared extension behavior.- Preserve the single shared modal shell and backdrop model; do not add a parallel overlay implementation.- Preserve modal z-index spacing with a stable base stack and a shared backdrop below the active modal.+- Keep the shared modal stack above the mobile right-canvas rail so blocking modals remain authoritative on small screens.- If opening a new modal from a close handler, schedule it with `requestAnimationFrame` to avoid stack removal races.- Keep modal state cleanup explicit because stores can outlive their DOM.- Device-specific styling may rely on the `device-touch` or `device-mouse` body class set during initialization.diff --git a/webui/js/modals.js b/webui/js/modals.jsindex 43bf16013..798aeb9e6 100644--- a/webui/js/modals.js+++ b/webui/js/modals.js@@ -107,7 +107,7 @@ document.body.appendChild(backdrop);// Function to update z-index for all modals and backdropfunction updateModalZIndexes() {// Base z-index for modals- const baseZIndex = 3000;+ const baseZIndex = 5000;// Update z-index for all modalsmodalStack.forEach((modal, index) => {