forge
Explore
Log in

Don't you dare go Hollow

The dropdown closes alone, the modal stays

Browse files at this commit

20280ed445b7fad346027aa028cd0fefff23ee2aAhmet Kaan GümüşParent: 40d8e18
  • fix
    • the dropdown closes alone, the modal stays
Show full message
🐛 fix(web): the dropdown closes alone, the modal stays

Escape on an open dropdown panel was closing the whole task modal: the
manager had the modal chain (90) above the dropdown (50). The old
per-script listeners made this edge path-dependent — a modal swapped in
softly registered last and lost to the dropdown, a full ?task= load
registered first and won — which is why every point fix tuned for one
path broke the other. The registry pins the correct order: dropdown 95,
above the modal chain.

Browser-proofed: nine Escape scenarios (modal, popover, datepick,
dropdown, card menu, user menu, rules composer, and both layered
collisions) pass in headless Chromium.
crates/izlek-web/src/dropdown.rsmodified+9 -4
@@ -18,9 +18,14 @@ use topcoat::view::{Unescaped, view};
18 /// Emitted once per page that renders a `<select>`; the enhancement is18 /// Emitted once per page that renders a `<select>`; the enhancement is
19 /// per-element and idempotent (`data-dd-done`), re-run on `izlek:wire` so19 /// per-element and idempotent (`data-dd-done`), re-run on `izlek:wire` so
20 /// selects arriving in a soft page swap get theirs too. Owns its own20 /// selects arriving in a soft page swap get theirs too. Owns its own
21-/// `Escape` resolver on `window.__izlekEsc` (priority 50 — an open panel21+/// `Escape` resolver on `window.__izlekEsc` (priority 95 — the dropdown
22-/// closes before the topbar and card-menu layers below it; the whole order22+/// outranks the modal chain: Escape on an open panel closes just the
23-/// lives in the table on `layout.rs`'s `escape_manager_script`).23+/// panel, never the modal above it. The old per-script listeners made
24+/// this order path-dependent — a modal swapped in by soft navigation
25+/// registered its listener last and lost to the dropdown; a full load
26+/// with `?task=` registered it first and the modal chain won, closing
27+/// the whole modal over an open dropdown — the registry pins the correct
28+/// order; the whole table lives in `layout.rs`'s `escape_manager_script`).
24 pub async fn dropdown_script(cx: &Cx) -> Result {29 pub async fn dropdown_script(cx: &Cx) -> Result {
25 const JS: &str = "\30 const JS: &str = "\
26 (function () {\31 (function () {\
@@ -117,7 +122,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
117 if (row) { pick(select, trigger, panel, row); }\122 if (row) { pick(select, trigger, panel, row); }\
118 });\123 });\
119 }\124 }\
120- window.__izlekEsc.register(50, function () {\125+ window.__izlekEsc.register(95, function () {\
121 var panel = document.querySelector('.dd-panel.dd-open');\126 var panel = document.querySelector('.dd-panel.dd-open');\
122 if (!panel) { return false; }\127 if (!panel) { return false; }\
123 var trigger = panel.__ddTrigger;\128 var trigger = panel.__ddTrigger;\
crates/izlek-web/src/layout.rsmodified+1 -1
@@ -295,8 +295,8 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
295 ///295 ///
296 /// | prio | closes | registered by |296 /// | prio | closes | registered by |
297 /// |------|--------|---------------|297 /// |------|--------|---------------|
298+/// | 95 | the open dropdown panel (refocusing its trigger) | `dropdown.rs`'s `dropdown_script` |
298 /// | 90 | the viewer, then the delete confirm, then non-datepick edit popovers, then the task modal | `detail.rs`'s `escape_closes` |299 /// | 90 | the viewer, then the delete confirm, then non-datepick edit popovers, then the task modal | `detail.rs`'s `escape_closes` |
299-/// | 50 | the open dropdown panel (refocusing its trigger) | `dropdown.rs`'s `dropdown_script` |
300 /// | 40 | the topbar `.user-menu` (pin+blur), then the rules composer, then a rules edit row (back to `/rules`) | `layout.rs`'s `escape_script` |300 /// | 40 | the topbar `.user-menu` (pin+blur), then the rules composer, then a rules edit row (back to `/rules`) | `layout.rs`'s `escape_script` |
301 /// | 20 | the datepicker popover | `board.rs`'s `card_menu_script` |301 /// | 20 | the datepicker popover | `board.rs`'s `card_menu_script` |
302 /// | 10 | the card context menu | `board.rs`'s `card_menu_script` |302 /// | 10 | the card context menu | `board.rs`'s `card_menu_script` |