diff --git a/crates/in-web/src/layout.rs b/crates/in-web/src/layout.rs index c935ba4..fc29f79 100644 --- a/crates/in-web/src/layout.rs +++ b/crates/in-web/src/layout.rs @@ -236,47 +236,54 @@ async fn family_of(cx: &Cx) -> Vec { } } -/// The topbar's suite switcher: every family entry as its wordmark, -/// beside the page nav, the current one marked. Rendered only when a -/// mirrored list is actually there. The links point at the services' own -/// addresses, so the cross-origin ones navigate the browser natively; -/// this app's entry lands where a soft-nav swap would have gone anyway. -async fn app_switcher(cx: &Cx) -> Result { +/// The monogram with the family behind it: the In mark as ever, and the +/// sibling services' wordmarks in a flyout that opens under it on hover +/// and on keyboard focus — the mark is an ``, so it is already +/// focusable and `:focus-within` needs nothing added. Middots between, +/// each a plain link to the service's own address, so the cross-origin +/// hop navigates the browser natively. No script: the flyout is CSS on +/// `:hover` / `:focus-within`, and it stays in the DOM at opacity zero so +/// Tab reaches its links. A family that is absent, or holds no one but +/// this app, renders the bare mark — there is nothing to reveal. +async fn family_mark(cx: &Cx) -> Result { let family = family_of(cx).await; - let empty = family.is_empty(); + let siblings: Vec<_> = family + .into_iter() + .filter(|service| service.key != SELF_KEY) + .collect(); + if siblings.is_empty() { + return mark(cx).await; + } view! { cx => - if !empty { +
+ (mark(cx).await?) - - } +
} } -/// The signed-in chrome: the monogram, the page nav, the suite switcher, -/// the identity menu. Wave-2 pages render their content under this. +/// The signed-in chrome: the monogram with the family behind it, the page +/// nav, the identity menu. Wave-2 pages render their content under this. pub async fn topbar(cx: &Cx, active: NavPage, user: &User, lang: Lang) -> Result { view! { cx =>
- (mark(cx).await?) + (family_mark(cx).await?) (topbar_nav(cx, active, lang).await?) - (app_switcher(cx).await?) (user_menu(cx, user, lang).await?)
(avatar_script(cx).await?) diff --git a/crates/in-web/tests/http.rs b/crates/in-web/tests/http.rs index 75f2bfb..6f213a1 100644 --- a/crates/in-web/tests/http.rs +++ b/crates/in-web/tests/http.rs @@ -2715,7 +2715,7 @@ async fn topbar_nav_has_no_search_link() { } #[tokio::test] -async fn the_suite_switcher_renders_when_the_family_is_mirrored() { +async fn the_family_flyout_holds_the_siblings_when_the_family_is_mirrored() { // No mirrored family: no switcher — the chrome as it always was. let bare = TestApp::build().await; let cookie = bare @@ -2743,12 +2743,16 @@ async fn the_suite_switcher_renders_when_the_family_is_mirrored() { .find("") .expect("switcher never closes"); let nav = &body[nav_start..nav_start + nav_end]; - assert!(nav.contains("href=\"https://files.example.com/\""), "{nav}"); + // Only the siblings hang in the flyout — this app's own row is the mark + // the flyout hangs from, not an entry in it. + assert!(!nav.contains("href=\"https://files.example.com/\""), "{nav}"); assert!(nav.contains("href=\"https://id.example.com/\""), "{nav}"); assert!(nav.contains("href=\"https://board.example.com/\""), "{nav}"); - assert!(nav.contains("title=\"Files\""), "{nav}"); - // Exactly the app the reader is already in is marked. - assert_eq!(nav.matches("aria-current").count(), 1, "{nav}"); + assert!(nav.contains("title=\"Account\""), "{nav}"); + assert_eq!(nav.matches("app-switcher-mark").count(), 2, "{nav}"); + assert_eq!(nav.matches("app-switcher-sep").count(), 1, "{nav}"); + // The flyout hangs off the monogram, not the page nav. + assert!(body.contains("wordmark-family"), "{body}"); } /// The `back` the sign-out hands im is read per sign-out: an origin saved diff --git a/style/main.scss b/style/main.scss index c94a21e..3ea88e0 100644 --- a/style/main.scss +++ b/style/main.scss @@ -443,12 +443,6 @@ a { } } -.topbar-divider { - width: 1px; - height: 20px; - background: var(--border); -} - .topbar-nav-links { display: flex; gap: 16px; @@ -479,17 +473,48 @@ a { } } -// The suite switcher: the other apps of the family, as their wordmarks, -// beside the page nav. Rendered only when `[[services]]` is set; the app -// the reader is already in is marked the way the page nav marks itself. -.app-switcher { +// The family behind the monogram: the sibling apps' wordmarks, middots +// between, in a flyout that hangs under the mark and shows on hover or on +// keyboard focus (the mark is a link, so it focuses itself). Absolutely +// placed, so the chrome keeps the bare monogram's width; it stays in the +// DOM so the links are reachable by tab, which is what opens it for a +// keyboard. No gap between mark and flyout, so the pointer can travel down +// into it without it closing. +.wordmark-family { + position: relative; display: flex; - align-items: center; - gap: 14px; - // The trio keeps its width at every width: the page nav beside it is the + // The mark keeps its width at every width: the page nav beside it is the // region that pans under the finger, this never squishes. flex: none; + &:hover .app-switcher, + &:focus-within .app-switcher { + opacity: 1; + transform: translate(0, 0); + pointer-events: auto; + } +} + +.app-switcher { + position: absolute; + top: 100%; + left: 0; + // Over the page, under the house dropdown's panel (60), which may open + // from a row the flyout hangs across. + z-index: 50; + display: flex; + align-items: baseline; + gap: 10px; + padding: 6px 12px; + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-2); + opacity: 0; + transform: translate(0, -4px); + pointer-events: none; + transition: opacity 120ms ease, transform 120ms ease; + &-mark { font-family: var(--font-mono); font-size: 13px; @@ -500,12 +525,8 @@ a { &:hover { color: var(--ink); } } - // The current app, spelled out — `&` stays at the head of a compound - // selector here, so the pair of classes cannot ride the ampersand. - .app-switcher-mark.app-switcher-here { - color: var(--ink); - box-shadow: inset 0 -2px 0 var(--ink); - } + + &-sep { color: var(--muted-soft); } } .scaffold-note { margin: 24px; @@ -4346,8 +4367,6 @@ input[type="radio"] { &::-webkit-scrollbar { display: none; } } - .app-switcher { gap: 10px; } - // The avatar says who is signed in at this width; the name is the menu's. .user-menu-trigger-name { display: none; } @@ -4360,8 +4379,6 @@ input[type="radio"] { } .topbar-nav-links { gap: 10px; } - - .app-switcher { gap: 8px; } } // -- board ----------------------------------------------------------------- @@ -4375,7 +4392,6 @@ input[type="radio"] { } // A rule floating alone at the head of a wrapped row says nothing. - .filterbar .topbar-divider { display: none; } .filterbar .primary, .filterbar .chip { flex: none; }