the family hides behind the monogram: the in im iz row beside the page nav goes, with its divider, and the siblings become a flyout that drops under the In mark on hover and on keyboard focus — the mark is already the link home, so focus-within opens it and Tab from it reaches the sibling links; the flyout stays in the DOM at opacity zero with no gap to the mark, so the pointer can travel down into it, no script; a mirror without siblings renders the bare mark, and the http test now asserts the siblings alone
Browse files at this commit5129757b0766cac1825db19c9bf8190ac6caf9dcParent: cfa2ba13 changed files +77 -50
- crates/in-web/src/layout.rs +28 -21
- crates/in-web/tests/http.rs +9 -5
- style/main.scss +40 -24
crates/in-web/src/layout.rsmodified+28 -21
| @@ -236,47 +236,54 @@ async fn family_of(cx: &Cx) -> Vec<in_client::ServiceJson> { | |||
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | -/// The topbar's suite switcher: every family entry as its wordmark, | 239 | +/// The monogram with the family behind it: the In mark as ever, and the |
| 240 | -/// beside the page nav, the current one marked. Rendered only when a | 240 | +/// sibling services' wordmarks in a flyout that opens under it on hover |
| 241 | -/// mirrored list is actually there. The links point at the services' own | 241 | +/// and on keyboard focus — the mark is an `<a href="/">`, so it is already |
| 242 | -/// addresses, so the cross-origin ones navigate the browser natively; | 242 | +/// focusable and `:focus-within` needs nothing added. Middots between, |
| 243 | -/// this app's entry lands where a soft-nav swap would have gone anyway. | 243 | +/// each a plain link to the service's own address, so the cross-origin |
| 244 | -async fn app_switcher(cx: &Cx) -> Result { | 244 | +/// hop navigates the browser natively. No script: the flyout is CSS on |
| 245 | +/// `:hover` / `:focus-within`, and it stays in the DOM at opacity zero so | ||
| 246 | +/// Tab reaches its links. A family that is absent, or holds no one but | ||
| 247 | +/// this app, renders the bare mark — there is nothing to reveal. | ||
| 248 | +async fn family_mark(cx: &Cx) -> Result { | ||
| 245 | let family = family_of(cx).await; | 249 | let family = family_of(cx).await; |
| 246 | - let empty = family.is_empty(); | 250 | + let siblings: Vec<_> = family |
| 251 | + .into_iter() | ||
| 252 | + .filter(|service| service.key != SELF_KEY) | ||
| 253 | + .collect(); | ||
| 254 | + if siblings.is_empty() { | ||
| 255 | + return mark(cx).await; | ||
| 256 | + } | ||
| 247 | view! { | 257 | view! { |
| 248 | cx => | 258 | cx => |
| 249 | - if !empty { | 259 | + <div class="wordmark-family"> |
| 260 | + (mark(cx).await?) | ||
| 250 | <nav class="app-switcher"> | 261 | <nav class="app-switcher"> |
| 251 | - for service in &family { | 262 | + for (i, service) in siblings.iter().enumerate() { |
| 263 | + if i > 0 { | ||
| 264 | + <span class="app-switcher-sep">"·"</span> | ||
| 265 | + } | ||
| 252 | <a | 266 | <a |
| 253 | - class=(if service.key == SELF_KEY { | 267 | + class="app-switcher-mark" |
| 254 | - "app-switcher-mark app-switcher-here" | ||
| 255 | - } else { | ||
| 256 | - "app-switcher-mark" | ||
| 257 | - }) | ||
| 258 | href=(format!("{}/", service.url)) | 268 | href=(format!("{}/", service.url)) |
| 259 | title=(service.name.clone()) | 269 | title=(service.name.clone()) |
| 260 | - aria-current=((service.key == SELF_KEY).then_some("page")) | ||
| 261 | > | 270 | > |
| 262 | (service.key.clone()) | 271 | (service.key.clone()) |
| 263 | </a> | 272 | </a> |
| 264 | } | 273 | } |
| 265 | </nav> | 274 | </nav> |
| 266 | - <span class="topbar-divider"></span> | 275 | + </div> |
| 267 | - } | ||
| 268 | } | 276 | } |
| 269 | } | 277 | } |
| 270 | 278 | ||
| 271 | -/// The signed-in chrome: the monogram, the page nav, the suite switcher, | 279 | +/// The signed-in chrome: the monogram with the family behind it, the page |
| 272 | -/// the identity menu. Wave-2 pages render their content under this. | 280 | +/// nav, the identity menu. Wave-2 pages render their content under this. |
| 273 | pub async fn topbar(cx: &Cx, active: NavPage, user: &User, lang: Lang) -> Result { | 281 | pub async fn topbar(cx: &Cx, active: NavPage, user: &User, lang: Lang) -> Result { |
| 274 | view! { | 282 | view! { |
| 275 | cx => | 283 | cx => |
| 276 | <header class="topbar"> | 284 | <header class="topbar"> |
| 277 | - (mark(cx).await?) | 285 | + (family_mark(cx).await?) |
| 278 | (topbar_nav(cx, active, lang).await?) | 286 | (topbar_nav(cx, active, lang).await?) |
| 279 | - (app_switcher(cx).await?) | ||
| 280 | (user_menu(cx, user, lang).await?) | 287 | (user_menu(cx, user, lang).await?) |
| 281 | </header> | 288 | </header> |
| 282 | (avatar_script(cx).await?) | 289 | (avatar_script(cx).await?) |
crates/in-web/tests/http.rsmodified+9 -5
| @@ -2715,7 +2715,7 @@ async fn topbar_nav_has_no_search_link() { | |||
| 2715 | } | 2715 | } |
| 2716 | 2716 | ||
| 2717 | #[tokio::test] | 2717 | #[tokio::test] |
| 2718 | -async fn the_suite_switcher_renders_when_the_family_is_mirrored() { | 2718 | +async fn the_family_flyout_holds_the_siblings_when_the_family_is_mirrored() { |
| 2719 | // No mirrored family: no switcher — the chrome as it always was. | 2719 | // No mirrored family: no switcher — the chrome as it always was. |
| 2720 | let bare = TestApp::build().await; | 2720 | let bare = TestApp::build().await; |
| 2721 | let cookie = bare | 2721 | let cookie = bare |
| @@ -2743,12 +2743,16 @@ async fn the_suite_switcher_renders_when_the_family_is_mirrored() { | |||
| 2743 | .find("</nav>") | 2743 | .find("</nav>") |
| 2744 | .expect("switcher never closes"); | 2744 | .expect("switcher never closes"); |
| 2745 | let nav = &body[nav_start..nav_start + nav_end]; | 2745 | let nav = &body[nav_start..nav_start + nav_end]; |
| 2746 | - assert!(nav.contains("href=\"https://files.example.com/\""), "{nav}"); | 2746 | + // Only the siblings hang in the flyout — this app's own row is the mark |
| 2747 | + // the flyout hangs from, not an entry in it. | ||
| 2748 | + assert!(!nav.contains("href=\"https://files.example.com/\""), "{nav}"); | ||
| 2747 | assert!(nav.contains("href=\"https://id.example.com/\""), "{nav}"); | 2749 | assert!(nav.contains("href=\"https://id.example.com/\""), "{nav}"); |
| 2748 | assert!(nav.contains("href=\"https://board.example.com/\""), "{nav}"); | 2750 | assert!(nav.contains("href=\"https://board.example.com/\""), "{nav}"); |
| 2749 | - assert!(nav.contains("title=\"Files\""), "{nav}"); | 2751 | + assert!(nav.contains("title=\"Account\""), "{nav}"); |
| 2750 | - // Exactly the app the reader is already in is marked. | 2752 | + assert_eq!(nav.matches("app-switcher-mark").count(), 2, "{nav}"); |
| 2751 | - assert_eq!(nav.matches("aria-current").count(), 1, "{nav}"); | 2753 | + assert_eq!(nav.matches("app-switcher-sep").count(), 1, "{nav}"); |
| 2754 | + // The flyout hangs off the monogram, not the page nav. | ||
| 2755 | + assert!(body.contains("wordmark-family"), "{body}"); | ||
| 2752 | } | 2756 | } |
| 2753 | 2757 | ||
| 2754 | /// The `back` the sign-out hands im is read per sign-out: an origin saved | 2758 | /// The `back` the sign-out hands im is read per sign-out: an origin saved |
style/main.scssmodified+40 -24
| @@ -443,12 +443,6 @@ a { | |||
| 443 | } | 443 | } |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | -.topbar-divider { | ||
| 447 | - width: 1px; | ||
| 448 | - height: 20px; | ||
| 449 | - background: var(--border); | ||
| 450 | -} | ||
| 451 | - | ||
| 452 | .topbar-nav-links { | 446 | .topbar-nav-links { |
| 453 | display: flex; | 447 | display: flex; |
| 454 | gap: 16px; | 448 | gap: 16px; |
| @@ -479,17 +473,48 @@ a { | |||
| 479 | } | 473 | } |
| 480 | } | 474 | } |
| 481 | 475 | ||
| 482 | -// The suite switcher: the other apps of the family, as their wordmarks, | 476 | +// The family behind the monogram: the sibling apps' wordmarks, middots |
| 483 | -// beside the page nav. Rendered only when `[[services]]` is set; the app | 477 | +// between, in a flyout that hangs under the mark and shows on hover or on |
| 484 | -// the reader is already in is marked the way the page nav marks itself. | 478 | +// keyboard focus (the mark is a link, so it focuses itself). Absolutely |
| 485 | -.app-switcher { | 479 | +// placed, so the chrome keeps the bare monogram's width; it stays in the |
| 480 | +// DOM so the links are reachable by tab, which is what opens it for a | ||
| 481 | +// keyboard. No gap between mark and flyout, so the pointer can travel down | ||
| 482 | +// into it without it closing. | ||
| 483 | +.wordmark-family { | ||
| 484 | + position: relative; | ||
| 486 | display: flex; | 485 | display: flex; |
| 487 | - align-items: center; | 486 | + // The mark keeps its width at every width: the page nav beside it is the |
| 488 | - gap: 14px; | ||
| 489 | - // The trio keeps its width at every width: the page nav beside it is the | ||
| 490 | // region that pans under the finger, this never squishes. | 487 | // region that pans under the finger, this never squishes. |
| 491 | flex: none; | 488 | flex: none; |
| 492 | 489 | ||
| 490 | + &:hover .app-switcher, | ||
| 491 | + &:focus-within .app-switcher { | ||
| 492 | + opacity: 1; | ||
| 493 | + transform: translate(0, 0); | ||
| 494 | + pointer-events: auto; | ||
| 495 | + } | ||
| 496 | +} | ||
| 497 | + | ||
| 498 | +.app-switcher { | ||
| 499 | + position: absolute; | ||
| 500 | + top: 100%; | ||
| 501 | + left: 0; | ||
| 502 | + // Over the page, under the house dropdown's panel (60), which may open | ||
| 503 | + // from a row the flyout hangs across. | ||
| 504 | + z-index: 50; | ||
| 505 | + display: flex; | ||
| 506 | + align-items: baseline; | ||
| 507 | + gap: 10px; | ||
| 508 | + padding: 6px 12px; | ||
| 509 | + background: var(--surface); | ||
| 510 | + border: 1px solid var(--border); | ||
| 511 | + border-radius: var(--radius); | ||
| 512 | + box-shadow: var(--shadow-2); | ||
| 513 | + opacity: 0; | ||
| 514 | + transform: translate(0, -4px); | ||
| 515 | + pointer-events: none; | ||
| 516 | + transition: opacity 120ms ease, transform 120ms ease; | ||
| 517 | + | ||
| 493 | &-mark { | 518 | &-mark { |
| 494 | font-family: var(--font-mono); | 519 | font-family: var(--font-mono); |
| 495 | font-size: 13px; | 520 | font-size: 13px; |
| @@ -500,12 +525,8 @@ a { | |||
| 500 | 525 | ||
| 501 | &:hover { color: var(--ink); } | 526 | &:hover { color: var(--ink); } |
| 502 | } | 527 | } |
| 503 | - // The current app, spelled out — `&` stays at the head of a compound | 528 | + |
| 504 | - // selector here, so the pair of classes cannot ride the ampersand. | 529 | + &-sep { color: var(--muted-soft); } |
| 505 | - .app-switcher-mark.app-switcher-here { | ||
| 506 | - color: var(--ink); | ||
| 507 | - box-shadow: inset 0 -2px 0 var(--ink); | ||
| 508 | - } | ||
| 509 | } | 530 | } |
| 510 | .scaffold-note { | 531 | .scaffold-note { |
| 511 | margin: 24px; | 532 | margin: 24px; |
| @@ -4346,8 +4367,6 @@ input[type="radio"] { | |||
| 4346 | &::-webkit-scrollbar { display: none; } | 4367 | &::-webkit-scrollbar { display: none; } |
| 4347 | } | 4368 | } |
| 4348 | 4369 | ||
| 4349 | - .app-switcher { gap: 10px; } | ||
| 4350 | - | ||
| 4351 | // The avatar says who is signed in at this width; the name is the menu's. | 4370 | // The avatar says who is signed in at this width; the name is the menu's. |
| 4352 | .user-menu-trigger-name { display: none; } | 4371 | .user-menu-trigger-name { display: none; } |
| 4353 | 4372 | ||
| @@ -4360,8 +4379,6 @@ input[type="radio"] { | |||
| 4360 | } | 4379 | } |
| 4361 | 4380 | ||
| 4362 | .topbar-nav-links { gap: 10px; } | 4381 | .topbar-nav-links { gap: 10px; } |
| 4363 | - | ||
| 4364 | - .app-switcher { gap: 8px; } | ||
| 4365 | } | 4382 | } |
| 4366 | 4383 | ||
| 4367 | // -- board ----------------------------------------------------------------- | 4384 | // -- board ----------------------------------------------------------------- |
| @@ -4375,7 +4392,6 @@ input[type="radio"] { | |||
| 4375 | } | 4392 | } |
| 4376 | 4393 | ||
| 4377 | // A rule floating alone at the head of a wrapped row says nothing. | 4394 | // A rule floating alone at the head of a wrapped row says nothing. |
| 4378 | - .filterbar .topbar-divider { display: none; } | ||
| 4379 | 4395 | ||
| 4380 | .filterbar .primary, | 4396 | .filterbar .primary, |
| 4381 | .filterbar .chip { flex: none; } | 4397 | .filterbar .chip { flex: none; } |