Commit 61b6a0d
committed
address Copilot review on #109
Six findings (4 inline + 2 in the review body, all valid):
1. `clear()` in header-search.js fired BOTH `filter.onInput('')` AND
`filter.onClear()`. Most gears were re-filtering twice; any side-
effectful onClear would run on top of the empty-input path. Pick
one path: prefer onClear if registered, otherwise dispatch empty
onInput. Removed the now-unused dispatchClear helper.
2. toggleSidebar() / applySidebarState() only updated the hidden
`#sidebar-icon-{collapse,expand}` shim left behind in the sidebar
for legacy code. The VISIBLE icons live in the new header toggle
(`#sidebar-icon-{collapse,expand}-header`) and were left untouched,
so clicking the toggle moved the sidebar but the icon never
swapped. Mirror the state to both pairs.
3. The `?` shortcut overlay is `role="dialog" aria-modal="true"` but
open() just removed `hidden` — focus stayed wherever it was, so
the dialog wasn't announced and keyboard focus could land outside
it. Make the overlay focusable on open and move focus into it;
restore focus to the prior element on close. No formal focus
trap is needed since the overlay has no interactive controls
(clicking anywhere closes).
4. The Overview gear restored the saved text filter by writing
__backendFilterQuery directly THEN calling HeaderSearch.setValue,
BEFORE registering the filter — so the bridge would never carry
restored state through the registered onInput. Swap the order:
register first, then setValue, and let the dispatch update the
query variable through the same code path keystrokes use.
5. The outside-click handler that collapses the compact mobile
search row checked `row.classList.contains('hidden')` to bail
when closed — but the row's templ markup is `hidden md:flex`, so
it ALWAYS carries `hidden` regardless of overlay state. The check
effectively disabled the feature. Use the .header-search-expanded
marker class instead, which the overlay state actually toggles.
6. The HeaderSearch templ doc-comment still described the original
"registered placeholder switches the input's placeholder" plan;
we dropped that earlier so the box reads the same on every page.
Updated the comment to match.
Verified in the browser: toggling the sidebar swaps the visible
header icon; clear() with both callbacks registered fires onClear
exactly once and onInput zero times; opening the help overlay moves
focus onto it.
Refs #921 parent 76b787b commit 61b6a0d
4 files changed
Lines changed: 98 additions & 40 deletions
File tree
- gearbox
- internal/framework/templates
- layouts
- pages
- static/js/common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
895 | 903 | | |
896 | 904 | | |
897 | 905 | | |
898 | 906 | | |
| 907 | + | |
| 908 | + | |
899 | 909 | | |
900 | 910 | | |
901 | 911 | | |
902 | 912 | | |
903 | 913 | | |
904 | 914 | | |
905 | 915 | | |
906 | | - | |
907 | | - | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
908 | 920 | | |
909 | 921 | | |
910 | 922 | | |
911 | 923 | | |
912 | 924 | | |
913 | 925 | | |
914 | | - | |
915 | | - | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
916 | 930 | | |
917 | 931 | | |
918 | 932 | | |
| |||
923 | 937 | | |
924 | 938 | | |
925 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
926 | 944 | | |
927 | 945 | | |
928 | 946 | | |
| |||
945 | 963 | | |
946 | 964 | | |
947 | 965 | | |
948 | | - | |
949 | | - | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
950 | 970 | | |
951 | 971 | | |
952 | 972 | | |
953 | 973 | | |
954 | 974 | | |
955 | | - | |
956 | | - | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
957 | 979 | | |
958 | 980 | | |
959 | 981 | | |
| |||
2473 | 2495 | | |
2474 | 2496 | | |
2475 | 2497 | | |
2476 | | - | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
2482 | 2505 | | |
2483 | 2506 | | |
2484 | 2507 | | |
| |||
Lines changed: 17 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | 575 | | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
591 | 579 | | |
592 | 580 | | |
593 | 581 | | |
| |||
598 | 586 | | |
599 | 587 | | |
600 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
601 | 603 | | |
602 | 604 | | |
603 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 184 | | |
193 | 185 | | |
194 | 186 | | |
| |||
218 | 210 | | |
219 | 211 | | |
220 | 212 | | |
221 | | - | |
222 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
223 | 229 | | |
224 | 230 | | |
225 | 231 | | |
| |||
339 | 345 | | |
340 | 346 | | |
341 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
342 | 354 | | |
343 | 355 | | |
344 | | - | |
| 356 | + | |
345 | 357 | | |
346 | 358 | | |
347 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
88 | 101 | | |
89 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
90 | 111 | | |
91 | 112 | | |
92 | 113 | | |
| |||
0 commit comments