Skip to content

Floating chrome: FloatingHeader, the Dock rail and bar, presence rings (0.28.0) - #58

Merged
kualta merged 2 commits into
mainfrom
floating-chrome
Nov 26, 2026
Merged

kualta merged 2 commits into
mainfrom
floating-chrome

Conversation

@kualta

@kualta kualta commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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, in components/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.
    • Desktop: a right-edge rail from 640px, centred on the profile avatar's line (48px from the right at 1440). Labels show in a solid popover on hover, keyboard focus and long-press.
    • Phone: a bottom bar on the insets, labels under the icons. It keeps the current place and the highest-priority items that fit its width; the rest go into a grouped More sheet that states each toggle's state in words.
    • Items: places are links (href or render) with aria-current. Controls are buttons. Toggles carry aria-pressed and show a dot, never the current place's fill.
    • States: inactive icons use --muted-foreground at 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. PresenceIndicator stays exported.
  • Showcase: ui.flow.industries adopts the top row and the Dock. The components page gains Floating Header and Dock entries and updated Profile Pill and Presence entries.
  • Docs: docs/product-headers.md is rewritten to the floating geometry.

Fixes UI-94
Related to FLOW-78

Breaking changes

  1. Dock items have a new shape, and the Dock now places itself.
    • Item fields: { label, icon, href?, render?, current?, external?, onClick?, pressed?, group?, priority?, shortcut?, badge?, badgeTone?, id? }.
    • icon is an element (<Home />), not a component (Home).
    • Removed item fields: customIcon (pass the element as icon), customComponent, extra, variant.
    • isActive is now current. It sets aria-current="page" on a link.
    • Removed props and types: the size prop and the DockSize type.
    • Positioning: the Dock is position: fixed itself (rail or bar), so drop any positioning classes you passed (fixed top-1/2 right-4 …). Its nav is labelled "Places and controls" unless you pass aria-label.
  2. ProfilePill defaults to size="sm" (a 24px avatar with a text-sm medium name). The old size="default" is now size="md", and profilePillVariants takes sm | md | lg.
  3. ProfilePill geometry changes.
    • Box: the pill is bare: no fill or outline until focus, when a 2px border shows 2px outside the presence ring. Its padding is now 8px on the name side and 2px elsewhere, inside the border. In FloatingHeader's end slot it moves 4px outward (through a flow-profile-pill class), so the ring's outer edge sits on the inset.
    • Avatar room: the avatar always reserves 4px for the ring.
    • Alignment: callers that aligned the old padded pill by hand should re-check it.
  4. Presence is a ring, not the corner badge. The ring is role="img" with the same names (Online, Idle, Busy, Invisible, Offline), so accessible names are unchanged.
    • Selectors: tests that selected [data-slot="presence-indicator"] inside a pill now need [data-slot="presence-ring"].
    • Offline: there is no ring, and the avatar greys.
  5. styles/base.css now imports floating.css.
    • New :root variables: --flow-top-row-inset, --flow-top-row-height, --flow-top-row-fade-height, --flow-dock-rail-room, --flow-dock-bar-room.
    • New Tailwind variants: dock-rail and dock-bar.
    • Scroll padding: html gets scroll-padding-top: var(--flow-top-row-fade-height) whenever a FloatingHeader is on the page.

Migration: replacing an app's header

import { Dock } from "@flow-industries/ui/components/dock";
import { FloatingHeader, HeaderBrand } from "@flow-industries/ui/components/header";
import { ProfilePill } from "@flow-industries/ui/components/profile-pill";
  1. Replace the header. Swap <Header layout="product">…</Header> (or the app's own header bar) for <FloatingHeader brand={…} end={…} />.
    • brand: the app's HeaderBrand at its default size, usually render={<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, with variant="secondary" where the page has its own main action.
    • Nothing else goes in the row: no title, readouts or controls.
  2. Move every header control into the Dock, after the app's places: <Dock items={[…places, …controls]} />.
    • Places: links with href (or render={<Link to="…" />} for a router) and current.
    • Controls: onClick buttons. Toggles also pass pressed.
    • Labels: carry what the old control showed ("Language · English"). Search passes shortcut="⌘K".
    • Phone bar: priority decides what stays when it runs out of width. labels translates More/On/Off.
  3. The spacer: FloatingHeader holds the row's 96px itself, so delete any top padding or margin that made room for the old header.
    • Grid layouts: pass the old header's grid area through containerClassName.
    • Already fixed and padded: if the page already pads for a fixed header, pass spacer={false}.
    • Live height: anything sized from the header's live height reads var(--flow-top-row-height) instead.
  4. Inner scrollers: if content scrolls in a box rather than the window, run the box under the row and attach the fade:
    const [scroller, setScroller] = useState<HTMLElement | null>(null);
    <FloatingHeader spacer={false} scrollTarget={scroller} brand={…} end={…} />
    <main ref={setScroller} className="h-dvh overflow-y-auto pt-(--flow-top-row-height) [scroll-padding-top:var(--flow-top-row-fade-height)]" />
    Pass the element (from a callback ref) if the scroller mounts after the header. A ref object is read once, at mount.
  5. Room for the Dock: keep content clear of it with sm:pr-(--flow-dock-rail-room) (or symmetric sm:px-… to keep centred content centred) and max-sm:pb-(--flow-dock-bar-room).
  6. Profile pills elsewhere: existing ProfilePill call sites that relied on the old default get the small size. Pass size="md" to keep the 32px avatar.
  7. Fixed-header assumptions: check pages that assumed a static header. Headings and anchors now land below the fade through scroll-padding-top, and inner scrollers need their own scroll-padding-top.

Testing

Local checks:

  • bun run lint: clean apart from the 9 warnings already on main.
  • bun run typecheck: clean.
  • Playwright against the built showcase: 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.ts and focus-provider.spec.ts all pass.
    • focus.spec.ts › "keyboard selection, pause, reload recovery and finish" fails identically on main locally.
  • Visual baselines were re-rendered with 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:

1440 390
Mark left edge 32 16
Mark size, wordmark 20x20, 19.8px 20x20, 19.8px
Logo centre y 48 48
Avatar size, centre y 24, 48 (header demo) —
Ring outer edge from right 32 = inset (header demo) —
Rail centre from right 48 = avatar centre from right —
Bar edges — 16 / 16, bottom 12
Content starts 96 96

Other checks:

  • Fade: off at the top, on after scrolling, 104px tall. It takes the page's colour and follows theme toggles.
  • Keyboard: focus shows the label and the pink border, and tab order is brand, then places, then controls.
  • Touch: on a 1024 tablet the rail items are 44px with the centre still 48px from the right. A long-press shows the label and swallows the tap; a tap navigates.
  • Phone: the bar keeps Design System, Showcases, Components and More (Dark mode and GitHub move to the sheet). The sheet states "Off"/"On", and the bar hides while a text field is focused.
  • Fallbacks: a 480px-tall window, print and forced colours put the row back in flow with the fade off, and the Dock is hidden in print.

Simplify pass: I reviewed the full diff against main.

  • Correctness fix: the nav's default aria-label moved into mergeable props, so a consumer's label now wins.
  • Simplification: the Dock's two grouping passes became one memo, and the More sheet is derived from the same groups.
  • Validation: lint, typecheck, the specs above and the browser check were re-run afterwards.

Separately, the first CI run caught a regression: the pill's negative margin let its focus border overflow narrow containers (presence.spec at 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 on transitionend.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T15:08:18.785607Z 915bd50 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +131 to +134
const visibleStatus = status === "invisible" && !self ? "offline" : status;
const name =
label ??
(visibleStatus === "idle" && away !== undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +452 to +454
const observer = new ResizeObserver(run);
observer.observe(bar);
observer.observe(row);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +139 to +143
const release = () => {
if (timer.current) clearTimeout(timer.current);
timer.current = held.current
? setTimeout(() => setOpen(false), 1200)
: null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@kualta
kualta merged commit 56bfbce into main Nov 26, 2026
5 checks passed
@kualta
kualta deleted the floating-chrome branch November 26, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant