max / makenotwork
1 file changed,
+24 insertions,
-2 deletions
| @@ -56,7 +56,14 @@ | |||
| 56 | 56 | * same one-variable walk the Rust side makes. | |
| 57 | 57 | */ | |
| 58 | 58 | const settle = (row) => { | |
| 59 | - | let shut = null; | |
| 59 | + | // Seeded from the row that was just pressed, which is the whole of | |
| 60 | + | // `d131a14c`: this started at `null` and only ever learned about a | |
| 61 | + | // *descendant's* chevron, so shutting a branch hid nothing at all. | |
| 62 | + | // Every row under a shut one is hidden, and the row's own state is the | |
| 63 | + | // only thing that says whether it is shut. | |
| 64 | + | let shut = row.querySelector(DISCLOSE)?.getAttribute("aria-expanded") === "false" | |
| 65 | + | ? depth(row) | |
| 66 | + | : null; | |
| 60 | 67 | for (const next of under(row)) { | |
| 61 | 68 | const level = depth(next); | |
| 62 | 69 | if (shut !== null && level <= shut) shut = null; | |
| @@ -69,6 +76,21 @@ | |||
| 69 | 76 | } | |
| 70 | 77 | }; | |
| 71 | 78 | ||
| 79 | + | // Capture, so this runs before anything bound on the way down. | |
| 80 | + | // | |
| 81 | + | // Found 2026-08-30 by the first test written against this file. Bubbling, | |
| 82 | + | // `stopPropagation` here stopped nothing that had already run: a listener | |
| 83 | + | // on the row is *below* the document in the bubble path, so it fires | |
| 84 | + | // first. That is not hypothetical -- `node.rs` hangs a table row's | |
| 85 | + | // `activate` on the row element (`Fires::ClickBeside`) and filters it with | |
| 86 | + | // `click[!event.target.closest('[data-act]')]`, which a chevron is not, so | |
| 87 | + | // pressing the chevron on a row that both discloses and activates folded | |
| 88 | + | // the branch *and* navigated away from it. The emitter's own comment | |
| 89 | + | // already claimed otherwise: "filters by it, pressing its chevron does | |
| 90 | + | // not." | |
| 91 | + | // | |
| 92 | + | // Fixed here rather than by widening that filter, because this is the one | |
| 93 | + | // place that knows what a chevron is. | |
| 72 | 94 | document.addEventListener("click", (event) => { | |
| 73 | 95 | const chevron = event.target.closest(DISCLOSE); | |
| 74 | 96 | if (!chevron) return; | |
| @@ -84,5 +106,5 @@ | |||
| 84 | 106 | chevron.setAttribute("aria-expanded", String(!open)); | |
| 85 | 107 | chevron.setAttribute("aria-label", open ? "Expand" : "Collapse"); | |
| 86 | 108 | settle(row); | |
| 87 | - | }); | |
| 109 | + | }, true); | |
| 88 | 110 | })(); |