Picking a theme in the profile corner no longer squeezes a "Done" tick between the three icon buttons: the pressed button is the confirmation, so that form opts out of the tick (data-no-tick), and its icon buttons dim while busy instead of growing a spinner
Browse files at this commit2dd20540a05a6f3e4c13aec997c1c326764b187eParent: 1889dfe- fix
- picking a theme in the profile corner no longer squeezes a "Done" tick between the three icon buttons: the pressed button is the confirmation, so that form opts out of the tick (data-no-tick), and its icon buttons dim while busy instead of growing a spinner
3 changed files +9 -2
crates/forge-web/assets/nav.jsmodified+3 -1
| @@ -2470,6 +2470,8 @@ | |||
| 2470 | value: btn ? btn.value : '', | 2470 | value: btn ? btn.value : '', |
| 2471 | text: btn ? buttonLabel(btn) : '', | 2471 | text: btn ? buttonLabel(btn) : '', |
| 2472 | dirty: form.hasAttribute('data-dirty-form'), | 2472 | dirty: form.hasAttribute('data-dirty-form'), |
| 2473 | + // data-no-tick: the page shown after the POST is its own confirmation (a pressed toggle). | ||
| 2474 | + quiet: form.hasAttribute('data-no-tick'), | ||
| 2473 | banner: !!(form.closest && form.closest('.site-banner')) | 2475 | banner: !!(form.closest && form.closest('.site-banner')) |
| 2474 | }; | 2476 | }; |
| 2475 | } | 2477 | } |
| @@ -2538,7 +2540,7 @@ | |||
| 2538 | // A refusal sent back on the query (merge_error, branch_error, error...) is not a success. | 2540 | // A refusal sent back on the query (merge_error, branch_error, error...) is not a success. |
| 2539 | if (/[?&]\w*error=/.test(r.url.search)) { return; } | 2541 | if (/[?&]\w*error=/.test(r.url.search)) { return; } |
| 2540 | var key = busy.key; | 2542 | var key = busy.key; |
| 2541 | - if (key.banner || document.querySelector('main .alert, main [role="alert"]')) { return; } | 2543 | + if (key.banner || key.quiet || document.querySelector('main .alert, main [role="alert"]')) { return; } |
| 2542 | var word = document.body.getAttribute(key.dirty ? 'data-done-saved' : 'data-done-ok'); | 2544 | var word = document.body.getAttribute(key.dirty ? 'data-done-saved' : 'data-done-ok'); |
| 2543 | var target = doneButton(key); | 2545 | var target = doneButton(key); |
| 2544 | if (target && word) { showTick(target, word); } | 2546 | if (target && word) { showTick(target, word); } |
crates/forge-web/src/views/mod.rsmodified+1 -1
| @@ -393,7 +393,7 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> | |||
| 393 | <a class="corner-link" href="/notifications">(all_label)</a> | 393 | <a class="corner-link" href="/notifications">(all_label)</a> |
| 394 | <hr class="corner-rule"> | 394 | <hr class="corner-rule"> |
| 395 | <div class="corner-theme"><span>(theme_label)</span> | 395 | <div class="corner-theme"><span>(theme_label)</span> |
| 396 | - <form method="post" action="/-/theme" class="corner-theme-set"> | 396 | + <form method="post" action="/-/theme" class="corner-theme-set" data-no-tick="true"> |
| 397 | <input type="hidden" name="csrf" value=(corner.csrf.as_str())> | 397 | <input type="hidden" name="csrf" value=(corner.csrf.as_str())> |
| 398 | <input type="hidden" name="back" value=(corner.back.as_str())> | 398 | <input type="hidden" name="back" value=(corner.back.as_str())> |
| 399 | <button type="submit" name="theme" value="auto" aria-pressed=(auto_pressed) title=(match_label) aria-label=(match_label)> | 399 | <button type="submit" name="theme" value="auto" aria-pressed=(auto_pressed) title=(match_label) aria-label=(match_label)> |
style/_shell.scssmodified+5 -0
| @@ -886,6 +886,11 @@ button.corner-link.link-button { | |||
| 886 | background: var(--surface-2); | 886 | background: var(--surface-2); |
| 887 | color: var(--text); | 887 | color: var(--text); |
| 888 | } | 888 | } |
| 889 | + | ||
| 890 | + // An icon button has no room for the spinner: dimming alone shows it is busy. | ||
| 891 | + &.is-busy::after { | ||
| 892 | + display: none; | ||
| 893 | + } | ||
| 889 | } | 894 | } |
| 890 | 895 | ||
| 891 | .ico { | 896 | .ico { |