Repository navigation
Floating chrome: FloatingHeader, the Dock rail and bar, presence rings (0.28.0) - #58
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 915bd505c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const visibleStatus = status === "invisible" && !self ? "offline" : status; | ||
| const name = | ||
| label ?? | ||
| (visibleStatus === "idle" && away !== undefined |
There was a problem hiding this comment.
Ignore custom invisible labels in public views
When status="invisible" is rendered with self={false}, the visual state is correctly mapped to Offline, but a supplied label/statusLabel is still announced verbatim. A caller passing a label such as "Invisible until 15:00" therefore exposes the hidden presence state to screen-reader users despite the component's public-view contract; ignore the override when invisible is being redacted, or require the accessible name to describe the mapped Offline state.
Useful? React with 👍 / 👎.
| const observer = new ResizeObserver(run); | ||
| observer.observe(bar); | ||
| observer.observe(row); |
There was a problem hiding this comment.
Re-measure bar labels after web fonts load
On a cold page load, this observer cannot detect a late web-font width change because row is the size-0 measurement container, whose own box remains zero while its children change. The first layout-effect measurement may therefore use fallback-font widths, and the fixed left/right bar also does not resize to trigger the other observation; a wider final font can leave the selected items overflowing or overlapping instead of moving another item into More. Observe the measurement children or explicitly rerun after fonts become ready.
Useful? React with 👍 / 👎.
| const release = () => { | ||
| if (timer.current) clearTimeout(timer.current); | ||
| timer.current = held.current | ||
| ? setTimeout(() => setOpen(false), 1200) | ||
| : null; |
There was a problem hiding this comment.
Clear stale long-press state after cancellation
If a touch long-press reaches the 450 ms threshold and then ends through pointercancel or pointerleave without a click, held.current remains true even after the delayed close runs. A subsequent keyboard activation or mouse click is then intercepted by onClickCapture and discarded as though it were the long-press's terminating click. Reset held.current when the delayed close expires while retaining it only long enough to suppress the immediate touch click.
Useful? React with 👍 / 👎.
Summary
Flow's floating chrome, as library parts, released as 0.28.0. Standalone apps lose their header bar; three bare islands replace it:
FloatingHeader(new, incomponents/header): the fixed top row. The brand sits on the left inset, and the profile or Sign in on the right. Both are centred 48px from the top: a 24px top inset plus the safe area, a 48px row, and side insets of 16px (32px from 768px). It renders its own 96px spacer and a full-width fade in the page's own background colour (solid to 80px, gone by 104px) that shows only once content is under the row. The fade can follow an inner scroller (scrollTarget). The row returns to the page flow for short windows and large text (a rem-based query), forced colours and print.Dock(rewritten): the app's places, then every main control.hreforrender) witharia-current. Controls are buttons. Toggles carryaria-pressedand show a dot, never the current place's fill.--muted-foregroundat full opacity, and coarse pointers get a 44px floor.ProfilePill: small, bare and mirrored by default. Presence is a ring (PresenceRing, new), 2px wide and 2px out, concentric with the squircle avatar. Online is full, idle opens clockwise by minutes away, busy is cut by a minus bar, invisible is dashed (self only), and offline greys the photo. Every state has an accessible name.PresenceIndicatorstays exported.docs/product-headers.mdis rewritten to the floating geometry.Fixes UI-94
Related to FLOW-78
Breaking changes
Dockitems have a new shape, and the Dock now places itself.{ label, icon, href?, render?, current?, external?, onClick?, pressed?, group?, priority?, shortcut?, badge?, badgeTone?, id? }.iconis an element (<Home />), not a component (Home).customIcon(pass the element asicon),customComponent,extra,variant.isActiveis nowcurrent. It setsaria-current="page"on a link.sizeprop and theDockSizetype.position: fixeditself (rail or bar), so drop any positioning classes you passed (fixed top-1/2 right-4 …). Itsnavis labelled "Places and controls" unless you passaria-label.ProfilePilldefaults tosize="sm"(a 24px avatar with atext-smmedium name). The oldsize="default"is nowsize="md", andprofilePillVariantstakessm | md | lg.ProfilePillgeometry changes.FloatingHeader's end slot it moves 4px outward (through aflow-profile-pillclass), so the ring's outer edge sits on the inset.role="img"with the same names (Online, Idle, Busy, Invisible, Offline), so accessible names are unchanged.[data-slot="presence-indicator"]inside a pill now need[data-slot="presence-ring"].styles/base.cssnow importsfloating.css.:rootvariables:--flow-top-row-inset,--flow-top-row-height,--flow-top-row-fade-height,--flow-dock-rail-room,--flow-dock-bar-room.dock-railanddock-bar.htmlgetsscroll-padding-top: var(--flow-top-row-fade-height)whenever aFloatingHeaderis on the page.Migration: replacing an app's header
<Header layout="product">…</Header>(or the app's own header bar) for<FloatingHeader brand={…} end={…} />.brand: the app'sHeaderBrandat its default size, usuallyrender={<a href="/" />}.end: the profile. Use<ProfilePill username image status self />, or its menu trigger (<DropdownMenuTrigger render={<ProfilePill … />} />). Signed out, pass Sign in instead:<Button>Sign in</Button>at the default height, withvariant="secondary"where the page has its own main action.<Dock items={[…places, …controls]} />.href(orrender={<Link to="…" />}for a router) andcurrent.onClickbuttons. Toggles also passpressed.shortcut="⌘K".prioritydecides what stays when it runs out of width.labelstranslates More/On/Off.FloatingHeaderholds the row's 96px itself, so delete any top padding or margin that made room for the old header.containerClassName.spacer={false}.var(--flow-top-row-height)instead.sm:pr-(--flow-dock-rail-room)(or symmetricsm:px-…to keep centred content centred) andmax-sm:pb-(--flow-dock-bar-room).ProfilePillcall sites that relied on the old default get the small size. Passsize="md"to keep the 32px avatar.scroll-padding-top, and inner scrollers need their ownscroll-padding-top.Testing
Local checks:
bun run lint: clean apart from the 9 warnings already onmain.bun run typecheck: clean.tests/floating.spec.ts(new, added to the a11y job),presence.spec.ts(rewritten for rings),a11y.spec.ts,header.spec.tsx,semantics.spec.ts,error-boundary.spec.tsandfocus-provider.spec.tsall pass.focus.spec.ts› "keyboard selection, pause, reload recovery and finish" fails identically onmainlocally.scripts/update-snapshots.sh.Browser check: Chromium on the local dev build, at 1440x900 and 390x844 in light and dark, with keyboard input and with touch emulation (390 phone, 1024 tablet). No console errors. Measured:
Other checks:
Simplify pass: I reviewed the full diff against
main.aria-labelmoved into mergeable props, so a consumer's label now wins.Separately, the first CI run caught a regression: the pill's negative margin let its focus border overflow narrow containers (
presence.specat 390px and 2x zoom). The pill now keeps its border inside its box, and the top row does the 4px alignment. Also, the browser check found that the fade colour went stale when the background animated during a theme switch (reduced motion does this too). The hook now reads the colour again ontransitionend.