Repository navigation
fix(ui): keep the theme toggle and the way back in guest mode - #345
Merged
Merged
Conversation
`setGuestSidebar(on)` hid `.user-chip` and `#logout-btn` when a guest entered the app. Its own comment claimed the opposite -- that the theme toggle stayed usable -- and that claim had never been checked. Two faces, both from the same hide set: 1. `#theme-toggle` is a DESCENDANT of `.user-chip` (the sidebar rework moved it there), and `.hidden` is `display: none !important`, so hiding the chip hid the toggle with it. The theme toggle is a device preference, not account identity. 2. `#logout-btn` is the app's ONLY control wired to `exitGuest()`. A guest never reaches the 401 path, so hiding that button removed the visitor's only way back to the login view: the market tells them "sign in to use this", and there is nowhere to sign in from. Fix: `setGuestSidebar` now addresses the account-identity children only (`.user-chip .avatar` and `.user-chip .chip-text`); the toggle and the logout button stay reachable. A `.user-chip > .theme-toggle` rule pushes the lone toggle to the right edge once the chip text is concealed. Shape is pinned by `state_gate::the_guest_shell_keeps_the_toggle_and_the_way_back`; the rosters (survivors, account identity, exit handles) are all derived from `ui/index.html` and `ui/js/app.js`, with no exception list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In guest mode the sidebar hid both of the things it must keep: the theme
toggle (hidden as a side effect) and the only control that leads back to the
login view.
setGuestSidebar's own comment claimed the theme toggle stayedusable, and that claim had never been checked against the markup.
Two faces, one hide set:
#theme-toggleis a descendant of.user-chip. The sidebar rework movedthe toggle into the user chip, and
.hiddenisdisplay: none !important,so hiding the chip hid the toggle with it. The theme toggle is a device
preference, not account identity.
#logout-btnis the app's only control wired toexitGuest(). A visitornever reaches the 401 path, so hiding that button removed the guest's only way
back to the login view: the marketplace answers "sign in to use this model",
and there is nowhere to sign in from. The guest then makes zero further
requests for the rest of the session.
Measured on the unfixed tree with an out-of-repo jsdom probe: of the 16 reachable
controls in the guest shell, none returns to the login view.
Related Issue
None — found while auditing the identity-boundary family of the sidebar.
Changes
ui/js/app.js—setGuestSidebar(on)now addresses the account-identitychildren only (
.user-chip .avatar,.user-chip .chip-text). The theme toggleand the logout button stay reachable. Comment corrected and expanded; the
previous wording stated the opposite of what the code did.
ui/css/style.css—.user-chip > .theme-toggle { margin-left: auto; }so thelone toggle does not hug the sidebar edge once the chip text is concealed.
(No effect while
.chip-text—flex: 1— is present.)ui/index.html— cache-bust tokens for the two changed assets.ui/README.md— the guest-mode contract now states that only account identityis concealed, with the scope of the static gate spelled out.
src/state_gate.rs—the_guest_shell_keeps_the_toggle_and_the_way_backplusthe_c2182_guest_shell_extractors_have_teeth.The gate pins the shape, not the pixels: it parses the real sidebar markup
(tag pairing gives parent/child), reads the concealment selectors out of
setGuestSidebar's body, and asserts four things — no interactive element inside.user-chipis reached by those selectors; the exit control (found by looking forexitGuest(call sites, skipping the definition) is not reached either; everyaccount-identity child is reached; and both the enter and exit paths call the
function. Rosters are derived from
ui/index.html/ui/js/app.js, with noexception list; the positive control pins today's three rosters so a silently
narrowed derivation cannot pass vacuously.
Tests
cargo test— 482 passed, 0 failed (baseline 480; +2)cargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleanOut-of-repo verification (jsdom 30.1.0, no JS runner in CI): 5 trees x 7 legs,
all as declared. The unfixed tree reproduces the defect (toggle unreachable,
logout unreachable, no control returns to the login view); the fixed tree passes
all four axis legs; and three competing fixes are each rejected by exactly the
leg they break — deleting the concealment (identity leaks), hiding the chip only
(toggle still swallowed), and moving the toggle out of the chip while keeping the
old hide set (visitor stranded).
Checklist
fix/)