Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(mobile): nav chrome sizing (#5800)

Peter Chinman824f69967e98
diff --git a/apps/web/src/components/app/mobile/MobileDockIsland.tsx b/apps/web/src/components/app/mobile/MobileDockIsland.tsx
index 0753b7e871..3aa2005305 100644
--- a/apps/web/src/components/app/mobile/MobileDockIsland.tsx
+++ b/apps/web/src/components/app/mobile/MobileDockIsland.tsx
@@ -3,13 +3,16 @@ import type { ParentProps } from 'solid-js';
/**
* The floating pill surface for dock controls. Controls (MobileDockButton,
- * MobileTouchMenu) render flat and always sit inside one of these — alone for
- * a single round button, or grouped so several share the pill:
+ * MobileTouchMenu.Trigger) render flat and always sit inside one of these —
+ * alone for a single round button, or grouped so several share the pill:
*
* ```tsx
- * <MobileDockIsland class="h-11 justify-between gap-3">
+ * <MobileDockIsland class="h-(--mobile-chrome-button-size) justify-between gap-(--mobile-chrome-gap)">
* <MobileDockButton icon={BellIcon} … />
- * <MobileTouchMenu triggerIcon={CaretUpIcon} … />
+ * <MobileTouchMenu>
+ * <MobileTouchMenu.Trigger icon={CaretUpIcon} … />
+ * …
+ * </MobileTouchMenu>
* </MobileDockIsland>
* ```
*
diff --git a/apps/web/src/components/app/mobile/MobileDockRow.tsx b/apps/web/src/components/app/mobile/MobileDockRow.tsx
index dcb7d55205..1744d7f2f6 100644
--- a/apps/web/src/components/app/mobile/MobileDockRow.tsx
+++ b/apps/web/src/components/app/mobile/MobileDockRow.tsx
@@ -27,7 +27,6 @@ import { MobileBottomEdgeFade } from './MobileEdgeFade';
import {
type MobileTouchIconComponent,
MobileTouchMenu,
- type MobileTouchMenuItem,
} from './MobileTouchMenu';
import { useMobileDockViews } from './mobile-dock-views';
import { pressPulse } from './pressPulse';
@@ -49,41 +48,51 @@ function CreateMenu() {
// desktop order's first entries nearest it.
const blocks = () => [...createBlocks()].reverse();
- const uploadItem: MobileTouchMenuItem = {
- id: 'upload-file',
- label: 'Upload file',
- icon: UploadIcon,
- animateIcon: false,
- onSelect: () => {
- openFilePicker({ multiple: true }, async (files) => {
- await handleFileUpload(files, false);
- });
- },
- };
-
return (
- <MobileDockIsland class="shrink-0">
- <MobileTouchMenu
- triggerIcon={CreateIcon}
- footerLabel="Create"
- items={[
- uploadItem,
- ...blocks().map((block) => {
- const useAnimatedIcon = ENABLE_ANIMATED_ICONS && block.animatedIcon;
- return {
- // Labels key the rows: 'Message' and 'Channel' share a
- // blockName.
- id: block.label,
- label: block.label,
- icon: useAnimatedIcon ? block.animatedIcon : block.icon,
- animateIcon: !!useAnimatedIcon,
- // The block's own action, exactly as the desktop menus invoke
- // it (e.g. Channel opens the new-channel modal).
- onSelect: () => block.keyDownHandler?.(),
- };
- }),
- ]}
- />
+ <MobileDockIsland class="shrink-0 flex justify-center items-center">
+ <MobileTouchMenu>
+ <MobileTouchMenu.Trigger
+ icon={CreateIcon}
+ class="size-(--mobile-chrome-button-size)"
+ iconClass="size-(--mobile-chrome-icon-size) [&_svg]:size-(--mobile-chrome-icon-size)"
+ />
+ <MobileTouchMenu.Content>
+ <MobileTouchMenu.Item
+ id="upload-file"
+ icon={UploadIcon}
+ animateIcon={false}
+ onSelect={() => {
+ openFilePicker({ multiple: true }, async (files) => {
+ await handleFileUpload(files, false);
+ });
+ }}
+ >
+ Upload file
+ </MobileTouchMenu.Item>
+ {/* Labels key the rows: 'Message' and 'Channel' share a
+ blockName. */}
+ <For each={blocks()}>
+ {(block) => {
+ const useAnimatedIcon =
+ ENABLE_ANIMATED_ICONS && block.animatedIcon;
+ return (
+ <MobileTouchMenu.Item
+ id={block.label}
+ icon={useAnimatedIcon ? block.animatedIcon : block.icon}
+ animateIcon={!!useAnimatedIcon}
+ // The block's own action, exactly as the desktop menus
+ // invoke it (e.g. Channel opens the new-channel modal).
+ onSelect={() => block.keyDownHandler?.()}
+ >
+ {block.label}
+ </MobileTouchMenu.Item>
+ );
+ }}
+ </For>
+ <MobileTouchMenu.Separator />
+ <MobileTouchMenu.Footer>Create</MobileTouchMenu.Footer>
+ </MobileTouchMenu.Content>
+ </MobileTouchMenu>
</MobileDockIsland>
);
}
@@ -123,12 +132,12 @@ function MobileDockButton(props: MobileDockButtonProps) {
props.onClick();
}}
class={cn(
- 'relative flex size-10 shrink-0 items-center justify-center rounded-full',
+ 'relative flex size-(--mobile-chrome-button-size) shrink-0 items-center justify-center rounded-full',
props.active && 'text-accent',
props.class
)}
>
- <div class="size-6 shrink-0 [&_svg]:size-6">
+ <div class="size-(--mobile-chrome-icon-size) shrink-0 [&_svg]:size-(--mobile-chrome-icon-size)">
{props.animateIcon === false ? (
<Dynamic component={props.icon} />
) : (
@@ -147,31 +156,42 @@ function MoreViewsMenu(props: {
const dockViews = useMobileDockViews();
return (
- <MobileTouchMenu
- triggerIcon={CaretUpIcon}
- footerLabel="Views"
- items={[
- {
- id: 'settings',
- label: 'Settings',
- icon: IconGear,
- active: settingsOpen,
- animateIcon: false,
- dividerAfter: true,
- onSelect: toggleSettings,
- },
- // Rows render top → bottom ending at the thumb: reverse the shared
- // canonical order so Inbox lands nearest it.
- ...[...dockViews()].reverse().map((view) => ({
- id: view.id,
- label: view.label,
- icon: view.icon,
- animateIcon: view.animateIcon,
- active: () => props.isActive(view.id),
- onSelect: () => props.onNavigate(view.id),
- })),
- ]}
- />
+ <MobileTouchMenu>
+ <MobileTouchMenu.Trigger
+ icon={CaretUpIcon}
+ class="size-(--mobile-chrome-button-size)"
+ iconClass="size-(--mobile-chrome-icon-size) [&_svg]:size-(--mobile-chrome-icon-size)"
+ />
+ <MobileTouchMenu.Content>
+ <MobileTouchMenu.Item
+ id="settings"
+ icon={IconGear}
+ active={settingsOpen()}
+ animateIcon={false}
+ onSelect={toggleSettings}
+ >
+ Settings
+ </MobileTouchMenu.Item>
+ <MobileTouchMenu.Separator />
+ {/* Rows render top → bottom ending at the thumb: reverse the shared
+ canonical order so Inbox lands nearest it. */}
+ <For each={[...dockViews()].reverse()}>
+ {(view) => (
+ <MobileTouchMenu.Item
+ id={view.id}
+ icon={view.icon}
+ animateIcon={view.animateIcon}
+ active={props.isActive(view.id)}
+ onSelect={() => props.onNavigate(view.id)}
+ >
+ {view.label}
+ </MobileTouchMenu.Item>
+ )}
+ </For>
+ <MobileTouchMenu.Separator />
+ <MobileTouchMenu.Footer>Views</MobileTouchMenu.Footer>
+ </MobileTouchMenu.Content>
+ </MobileTouchMenu>
);
}
@@ -203,7 +223,7 @@ function MobileCompactDockRow() {
return (
<div class="flex w-full justify-between">
- <MobileDockIsland class="h-11 min-w-0 justify-between gap-3">
+ <MobileDockIsland class="h-(--mobile-chrome-button-size) min-w-0 justify-between gap-(--mobile-chrome-gap)">
<For each={navButtons()}>
{(button) => (
<MobileDockButton
@@ -255,7 +275,7 @@ export function MobileDockRow(props: MobileDockRowProps) {
return (
<div
class={cn(
- 'flex items-center gap-3 px-(--mobile-chrome-gutter)',
+ 'flex items-center gap-(--mobile-chrome-gap) px-(--mobile-chrome-gutter)',
props.class
)}
>
diff --git a/apps/web/src/components/app/mobile/MobileEdgeFade.tsx b/apps/web/src/components/app/mobile/MobileEdgeFade.tsx
index bb275c4d9b..739e112d27 100644
--- a/apps/web/src/components/app/mobile/MobileEdgeFade.tsx
+++ b/apps/web/src/components/app/mobile/MobileEdgeFade.tsx
@@ -8,8 +8,8 @@ import { Show } from 'solid-js';
*/
/** Extra distance the gradients bleed past the chrome they cover. */
-const TOP_FALLOFF = '0rem';
-const BOTTOM_FALLOFF = '2rem';
+const TOP_FALLOFF = '0px';
+const BOTTOM_FALLOFF = '32px';
export function MobileTopEdgeFade() {
return (
diff --git a/apps/web/src/components/app/mobile/MobileTouchMenu.css b/apps/web/src/components/app/mobile/MobileTouchMenu.css
index 970110ba14..39c3a54baf 100644
--- a/apps/web/src/components/app/mobile/MobileTouchMenu.css
+++ b/apps/web/src/components/app/mobile/MobileTouchMenu.css
@@ -1,14 +1,14 @@
@keyframes mobile-touch-menu-show {
from {
- width: 10rem;
- height: 5rem;
+ width: 160px;
+ height: 80px;
}
to {
width: var(
--mobile-touch-menu-width,
- calc(100vw - 2 * var(--mobile-chrome-gutter, 0.75rem))
+ calc(100vw - 2 * var(--mobile-chrome-gutter, 12px))
);
- height: var(--mobile-touch-menu-height, 23.5rem);
+ height: var(--mobile-touch-menu-height, 376px);
}
}
@@ -16,14 +16,14 @@
from {
width: var(
--mobile-touch-menu-width,
- calc(100vw - 2 * var(--mobile-chrome-gutter, 0.75rem))
+ calc(100vw - 2 * var(--mobile-chrome-gutter, 12px))
);
- height: var(--mobile-touch-menu-height, 23.5rem);
+ height: var(--mobile-touch-menu-height, 376px);
opacity: 1;
}
to {
- width: 0rem;
- height: 0rem;
+ width: 0px;
+ height: 0px;
opacity: 0;
}
}
diff --git a/apps/web/src/components/app/mobile/MobileTouchMenu.tsx b/apps/web/src/components/app/mobile/MobileTouchMenu.tsx
index 8348b313fc..0dec396dbb 100644
--- a/apps/web/src/components/app/mobile/MobileTouchMenu.tsx
+++ b/apps/web/src/components/app/mobile/MobileTouchMenu.tsx
@@ -1,15 +1,17 @@
import './MobileTouchMenu.css';
import { hapticImpact } from '@core/mobile/haptics';
-import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { ICON_ANIMATION_DURATION_MS } from '@icon/animation';
import { createElementSize } from '@solid-primitives/resize-observer';
import { cn, Layer } from '@ui';
import {
type Component,
+ createContext,
+ createEffect,
createSignal,
- For,
- type JSXElement,
+ onCleanup,
+ type ParentProps,
Show,
+ useContext,
} from 'solid-js';
import { Dynamic, Portal } from 'solid-js/web';
import { pressPulse } from './pressPulse';
@@ -24,25 +26,32 @@ export type MobileTouchIconComponentProps = {
export type MobileTouchIconComponent = Component<MobileTouchIconComponentProps>;
-export type MobileTouchMenuItem = {
- id: string;
- label: JSXElement;
- icon?: MobileTouchIconComponent;
- active?: () => boolean;
- animateIcon?: boolean;
- /** Draw a separator line below this row. */
- dividerAfter?: boolean;
- onSelect: () => void;
+type MobileTouchMenuContextValue = {
+ open: () => boolean;
+ mounted: () => boolean;
+ hoveredId: () => string | null;
+ triggerBottomOffset: () => number;
+ toggle: () => void;
+ /** Animated close: plays the hide animation, then Content unmounts. */
+ close: () => void;
+ /** Instant removal, once the hide animation ends or a row is selected. */
+ unmount: () => void;
+ select: (id: string | null) => void;
+ registerItem: (id: string, onSelect: () => void) => void;
+ unregisterItem: (id: string) => void;
+ setTriggerRef: (el: HTMLElement) => void;
+ onTriggerTouchMove: (e: TouchEvent) => void;
+ onTriggerTouchEnd: () => void;
};
-export type MobileTouchMenuTriggerProps = {
- open: boolean;
- ref: (el: HTMLElement) => void;
- onPointerDown: () => void;
- onClick: (e: MouseEvent) => void;
- onTouchMove: (e: TouchEvent) => void;
- onTouchEnd: (e: TouchEvent) => void;
-};
+const MobileTouchMenuContext = createContext<MobileTouchMenuContextValue>();
+
+function useMenu(part: string) {
+ const menu = useContext(MobileTouchMenuContext);
+ if (!menu)
+ throw new Error(`${part} must be rendered inside <MobileTouchMenu>`);
+ return menu;
+}
type MobileTouchMenuButtonProps = {
icon: MobileTouchIconComponent;
@@ -51,6 +60,7 @@ type MobileTouchMenuButtonProps = {
onTouchMove?: (e: TouchEvent) => void;
onTouchEnd?: (e: TouchEvent) => void;
class?: string;
+ iconClass?: string;
animateIcon?: boolean;
};
@@ -75,7 +85,7 @@ function MobileTouchMenuButton(props: MobileTouchMenuButtonProps) {
onTouchEnd={props.onTouchEnd}
class={cn('flex items-center justify-center', props.class)}
>
- <div class="size-6 [&_svg]:size-6">
+ <div class={cn('size-6 [&_svg]:size-6', props.iconClass)}>
{props.animateIcon === false ? (
<Dynamic component={props.icon} />
) : (
@@ -87,47 +97,51 @@ function MobileTouchMenuButton(props: MobileTouchMenuButtonProps) {
}
/**
+ * A native-feeling touch menu: press the trigger and the menu springs open;
+ * slide the still-down finger over rows (hover styling + haptics) and release
+ * to select. Composed Kobalte-style — this root owns the open/selection state
+ * and the parts wire up through context:
+ *
+ * ```tsx
+ * <MobileTouchMenu>
+ * <MobileTouchMenu.Trigger icon={CaretUpIcon} />
+ * <MobileTouchMenu.Content>
+ * <MobileTouchMenu.Item id="settings" onSelect={…}>Settings</MobileTouchMenu.Item>
+ * <MobileTouchMenu.Separator />
+ * <MobileTouchMenu.Footer>Views</MobileTouchMenu.Footer>
+ * </MobileTouchMenu.Content>
+ * </MobileTouchMenu>
+ * ```
+ *
* The trigger renders flat: hosts wrap it in a MobileDockIsland (alone or
* grouped with other controls) to give it the floating chrome.
*/
-export function MobileTouchMenu(props: {
- triggerIcon: MobileTouchIconComponent;
- position?: 'bottom-row' | 'trigger-bottom';
- footerLabel: string;
- items: MobileTouchMenuItem[];
-}) {
+function MobileTouchMenuRoot(props: ParentProps) {
// `open` drives the show/hide animation (via data-expanded); `mounted`
// keeps the overlay in the DOM until the hide animation finishes.
const [open, setOpen] = createSignal(false);
const [mounted, setMounted] = createSignal(false);
const [hoveredId, setHoveredId] = createSignal<string | null>(null);
- // The menu's natural size, fed to the open/close animation as CSS vars.
- const [menuRef, setMenuRef] = createSignal<HTMLDivElement>();
const [triggerRef, setTriggerRef] = createSignal<HTMLElement>();
- const [triggerBottomOffset, setTriggerBottomOffset] = createSignal<number>();
- const menuSize = createElementSize(menuRef);
+ const [triggerBottomOffset, setTriggerBottomOffset] = createSignal(0);
- const position = () => props.position ?? 'bottom-row';
- const triggerPositioned = () =>
- position() === 'trigger-bottom' && triggerBottomOffset() !== undefined;
+ // Items register their action so slide-select — which hit-tests DOM rows
+ // from the trigger's touch events — can dispatch by row id.
+ const itemActions = new Map<string, () => void>();
- const syncTriggerPosition = () => {
- if (position() !== 'trigger-bottom') {
- setTriggerBottomOffset(undefined);
- return;
- }
+ const openMenu = () => {
+ // The open menu rests on the trigger's bottom edge, measured at open
+ // time: dock triggers put it on the dock row, higher triggers (e.g. the
+ // PillTabs overflow) hold it at their own height.
const trigger = triggerRef();
- if (!trigger) {
- setTriggerBottomOffset(undefined);
- return;
- }
setTriggerBottomOffset(
- Math.max(0, window.innerHeight - trigger.getBoundingClientRect().bottom)
+ trigger
+ ? Math.max(
+ 0,
+ window.innerHeight - trigger.getBoundingClientRect().bottom
+ )
+ : 0
);
- };
-
- const openMenu = () => {
- syncTriggerPosition();
setMounted(true);
setOpen(true);
};
@@ -145,10 +159,12 @@ export function MobileTouchMenu(props: {
setHoveredId(null);
};
- const toggleMenu = () => (open() ? closeMenu() : openMenu());
-
- const getItem = (id: string | null) =>
- id ? props.items.find((item) => item.id === id) : undefined;
+ const select = (id: string | null) => {
+ const action = id ? itemActions.get(id) : undefined;
+ if (!action) return;
+ action();
+ dismissMenu();
+ };
const handleTouchMove = (e: TouchEvent) => {
if (!open()) return;
@@ -164,13 +180,6 @@ export function MobileTouchMenu(props: {
}
};
- const select = (id: string | null) => {
- const item = getItem(id);
- if (!item) return;
- item.onSelect();
- dismissMenu();
- };
-
const handleTouchEnd = () => {
const id = hoveredId();
setHoveredId(null);
@@ -178,116 +187,178 @@ export function MobileTouchMenu(props: {
};
return (
- <>
- <MobileTouchMenuButton
- ref={setTriggerRef}
- icon={props.triggerIcon}
- animateIcon={false}
- onPointerDown={toggleMenu}
- onTouchMove={handleTouchMove}
- onTouchEnd={handleTouchEnd}
- class="size-10 rounded-full"
- />
- <Show when={mounted()}>
- <Portal>
- {/* Portaled to <body>, outside FloatRegionHost's Layer. Re-apply
- depth 3 so the menu's surface matches the rest of the chrome. */}
- <Layer depth={3}>
+ <MobileTouchMenuContext.Provider
+ value={{
+ open,
+ mounted,
+ hoveredId,
+ triggerBottomOffset,
+ toggle: () => (open() ? closeMenu() : openMenu()),
+ close: closeMenu,
+ unmount: () => setMounted(false),
+ select,
+ registerItem: (id, onSelect) => itemActions.set(id, onSelect),
+ unregisterItem: (id) => itemActions.delete(id),
+ setTriggerRef: (el) => setTriggerRef(el),
+ onTriggerTouchMove: handleTouchMove,
+ onTriggerTouchEnd: handleTouchEnd,
+ }}
+ >
+ {props.children}
+ </MobileTouchMenuContext.Provider>
+ );
+}
+
+function MobileTouchMenuTrigger(props: {
+ icon: MobileTouchIconComponent;
+ class?: string;
+ iconClass?: string;
+}) {
+ const menu = useMenu('MobileTouchMenu.Trigger');
+
+ return (
+ <MobileTouchMenuButton
+ ref={menu.setTriggerRef}
+ icon={props.icon}
+ animateIcon={false}
+ onPointerDown={menu.toggle}
+ onTouchMove={menu.onTriggerTouchMove}
+ onTouchEnd={menu.onTriggerTouchEnd}
+ class={cn('size-10 rounded-full', props.class)}
+ iconClass={props.iconClass}
+ />
+ );
+}
+
+function MobileTouchMenuContent(props: ParentProps) {
+ const menu = useMenu('MobileTouchMenu.Content');
+ // The menu's natural size, fed to the open/close animation as CSS vars.
+ const [menuRef, setMenuRef] = createSignal<HTMLDivElement>();
+ const menuSize = createElementSize(menuRef);
+
+ return (
+ <Show when={menu.mounted()}>
+ <Portal>
+ {/* Portaled to <body>, outside FloatRegionHost's Layer. Re-apply
+ depth 3 so the menu's surface matches the rest of the chrome. */}
+ <Layer depth={3}>
+ <div
+ class="fixed inset-0 z-modal flex items-end justify-center"
+ style={{ 'padding-bottom': `${menu.triggerBottomOffset()}px` }}
+ onPointerDown={(e) => {
+ if (e.target === e.currentTarget) menu.close();
+ }}
+ >
<div
- class={cn(
- 'fixed inset-0 z-modal flex items-end justify-center',
- !triggerPositioned() && 'pb-3',
- !triggerPositioned() && isNativeMobilePlatform() && 'pb-7'
- )}
+ class="mobile-touch-menu-content flex items-end justify-start overflow-hidden rounded-2xl border border-edge bg-menu shadow-xl"
+ data-expanded={menu.open() ? '' : undefined}
style={{
- 'padding-bottom': triggerPositioned()
- ? `${triggerBottomOffset()}px`
+ '--mobile-touch-menu-width': menuSize.width
+ ? `${menuSize.width}px`
+ : undefined,
+ '--mobile-touch-menu-height': menuSize.height
+ ? `${menuSize.height}px`
: undefined,
}}
- onPointerDown={(e) => {
- if (e.target === e.currentTarget) closeMenu();
+ onAnimationEnd={(e) => {
+ // Icon animations bubble animationend; only unmount when the
+ // container's own hide animation completes.
+ if (e.target === e.currentTarget && !menu.open())
+ menu.unmount();
}}
>
<div
- class="mobile-touch-menu-content flex items-end justify-start overflow-hidden rounded-2xl border border-edge bg-menu shadow-xl"
- data-expanded={open() ? '' : undefined}
- style={{
- '--mobile-touch-menu-width': menuSize.width
- ? `${menuSize.width}px`
- : undefined,
- '--mobile-touch-menu-height': menuSize.height
- ? `${menuSize.height}px`
- : undefined,
- }}
- onAnimationEnd={(e) => {
- // Icon animations bubble animationend; only unmount when the
- // container's own hide animation completes.
- if (e.target === e.currentTarget && !open())
- setMounted(false);
- }}
+ class="flex w-[calc(100vw-2*var(--mobile-chrome-gutter))] shrink-0 flex-col gap-1 p-1"
+ ref={setMenuRef}
>
- <div
- class="flex w-[calc(100vw-2*var(--mobile-chrome-gutter))] shrink-0 flex-col gap-1 p-1"
- ref={setMenuRef}
- >
- <For each={props.items}>
- {(item) => (
- <>
- <button
- type="button"
- data-mobile-touch-menu-item={item.id}
- class={cn(
- 'flex h-11 items-center gap-2 rounded-lg px-3 text-sm',
- item.active?.() ? 'text-accent' : 'text-ink',
- hoveredId() === item.id
- ? 'bg-hover'
- : 'hover:bg-hover'
- )}
- onClick={() => {
- hapticImpact('light');
- select(item.id);
- }}
- >
- <Show when={item.icon}>
- {(Icon) => (
- <div class="size-4 shrink-0 [&_svg]:size-4">
- <Show
- when={item.animateIcon !== false}
- fallback={<Dynamic component={Icon()} />}
- >
- <Dynamic
- component={Icon()}
- triggerAnimation={hoveredId() === item.id}
- />
- </Show>
- </div>
- )}
- </Show>
- <span>{item.label}</span>
- </button>
- <Show when={item.dividerAfter}>
- <div class="-mx-1 h-px shrink-0 bg-edge" />
- </Show>
- </>
- )}
- </For>
- <div class="-mx-1 h-px shrink-0 bg-edge" />
- <button
- type="button"
- class="flex h-9 shrink-0 items-center px-3 text-sm font-medium text-ink-muted"
- onPointerDown={() => {
- hapticImpact('light');
- closeMenu();
- }}
- >
- <span>{props.footerLabel}</span>
- </button>
- </div>
+ {props.children}
</div>
</div>
- </Layer>
- </Portal>
+ </div>
+ </Layer>
+ </Portal>
+ </Show>
+ );
+}
+
+function MobileTouchMenuItem(
+ props: ParentProps<{
+ id: string;
+ icon?: MobileTouchIconComponent;
+ active?: boolean;
+ /** Plain svg icons (e.g. Gear) don't accept `triggerAnimation`. */
+ animateIcon?: boolean;
+ onSelect: () => void;
+ }>
+) {
+ const menu = useMenu('MobileTouchMenu.Item');
+
+ createEffect(() => {
+ const id = props.id;
+ menu.registerItem(id, () => props.onSelect());
+ onCleanup(() => menu.unregisterItem(id));
+ });
+
+ return (
+ <button
+ type="button"
+ data-mobile-touch-menu-item={props.id}
+ class={cn(
+ 'flex h-11 items-center gap-2 rounded-lg px-3 text-sm',
+ props.active ? 'text-accent' : 'text-ink',
+ menu.hoveredId() === props.id ? 'bg-hover' : 'hover:bg-hover'
+ )}
+ onClick={() => {
+ hapticImpact('light');
+ menu.select(props.id);
+ }}
+ >
+ <Show when={props.icon}>
+ {(Icon) => (
+ <div class="size-4 shrink-0 [&_svg]:size-4">
+ <Show
+ when={props.animateIcon !== false}
+ fallback={<Dynamic component={Icon()} />}
+ >
+ <Dynamic
+ component={Icon()}
+ triggerAnimation={menu.hoveredId() === props.id}
+ />
+ </Show>
+ </div>
+ )}
</Show>
- </>
+ <span>{props.children}</span>
+ </button>
);
}
+
+function MobileTouchMenuSeparator() {
+ return <div class="-mx-1 h-px shrink-0 bg-edge" />;
+}
+
+/** The bottom row labeling the menu; pressing it closes without selecting. */
+function MobileTouchMenuFooter(props: ParentProps) {
+ const menu = useMenu('MobileTouchMenu.Footer');
+
+ return (
+ <button
+ type="button"
+ class="flex h-9 shrink-0 items-center px-3 text-sm font-medium text-ink-muted"
+ onPointerDown={() => {
+ hapticImpact('light');
+ menu.close();
+ }}
+ >
+ <span>{props.children}</span>
+ </button>
+ );
+}
+
+export const MobileTouchMenu = Object.assign(MobileTouchMenuRoot, {
+ Trigger: MobileTouchMenuTrigger,
+ Content: MobileTouchMenuContent,
+ Item: MobileTouchMenuItem,
+ Separator: MobileTouchMenuSeparator,
+ Footer: MobileTouchMenuFooter,
+});
diff --git a/apps/web/src/components/app/mobile/PillTabs.tsx b/apps/web/src/components/app/mobile/PillTabs.tsx
index f5068afa22..75e9740aff 100644
--- a/apps/web/src/components/app/mobile/PillTabs.tsx
+++ b/apps/web/src/components/app/mobile/PillTabs.tsx
@@ -459,17 +459,24 @@ function MenuOverflowPillTabs<T extends string>(props: PillTabsProps<T>) {
</For>
<Show when={overflowItems().length > 0}>
<MobileDockIsland class="shrink-0">
- <MobileTouchMenu
- triggerIcon={DotsThreeIcon}
- position="trigger-bottom"
- footerLabel="Tabs"
- items={overflowItems().map((item) => ({
- id: item.value,
- label: item.label,
- active: () => props.value === item.value,
- onSelect: () => props.onChange(item.value),
- }))}
- />
+ <MobileTouchMenu>
+ <MobileTouchMenu.Trigger icon={DotsThreeIcon} />
+ <MobileTouchMenu.Content>
+ <For each={overflowItems()}>
+ {(item) => (
+ <MobileTouchMenu.Item
+ id={item.value}
+ active={props.value === item.value}
+ onSelect={() => props.onChange(item.value)}
+ >
+ {item.label}
+ </MobileTouchMenu.Item>
+ )}
+ </For>
+ <MobileTouchMenu.Separator />
+ <MobileTouchMenu.Footer>Tabs</MobileTouchMenu.Footer>
+ </MobileTouchMenu.Content>
+ </MobileTouchMenu>
</MobileDockIsland>
</Show>
<div
diff --git a/apps/web/src/components/app/mobile/float-regions/FloatRegionHost.tsx b/apps/web/src/components/app/mobile/float-regions/FloatRegionHost.tsx
index 8eeb40efe7..48b01f96a4 100644
--- a/apps/web/src/components/app/mobile/float-regions/FloatRegionHost.tsx
+++ b/apps/web/src/components/app/mobile/float-regions/FloatRegionHost.tsx
@@ -39,9 +39,13 @@ export function FloatRegionHost() {
<div
ref={setHostRef}
class={cn(
- 'pointer-events-none absolute inset-x-0 bottom-0 z-mobile-nav-bar flex flex-col gap-3 pb-3',
- isNativeMobilePlatform() && 'pb-7',
- virtualKeyboardVisible() && 'pb-3'
+ // The stack's own spacing rides the px --mobile-chrome-* vars
+ // (see index.css): chrome must not track the OS text-size setting.
+ // Only the chrome pins itself — accessory contributions (compose /
+ // reply bars) keep rem sizing.
+ 'pointer-events-none absolute inset-x-0 bottom-0 z-mobile-nav-bar flex flex-col gap-(--mobile-chrome-gutter) pb-(--mobile-chrome-gutter)',
+ isNativeMobilePlatform() && 'pb-[28px]',
+ virtualKeyboardVisible() && 'pb-(--mobile-chrome-gutter)'
)}
>
<For each={FLOAT_REGIONS}>
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index fc7708aacb..32e4b9fbc9 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -511,7 +511,8 @@ export function SplitHeader(props: {
class={cn(
'@container/split-header isolate relative w-full h-full overflow-clip text-ink',
// On mobile the header overlays the panel body as a transparent strip
- // of floating islands
+ // of floating islands; the island utility's px min-size keeps them
+ // tappable regardless of the OS text-size setting (inert on desktop).
'touch:absolute touch:inset-x-0 touch:top-(--safe-top) touch:z-mobile-nav-bar touch:h-11.25 touch:overflow-visible touch:pointer-events-none',
isMobile() &&
!isNativeMobilePlatform() &&
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
index 1667ff3119..e1ad7d85d1 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
@@ -337,7 +337,7 @@ export const MobileFilterDrawer = (props: {
size="sm"
depth={3}
class={cn(
- 'island bg-chrome pointer-events-auto relative size-10 shrink-0 rounded-full [&_svg]:size-5',
+ 'island bg-chrome pointer-events-auto relative size-10 shrink-0 rounded-full [&_svg]:size-6',
props.class
)}
ref={pressPulse}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index bae31c6ef7..51e2fe96b6 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -70,10 +70,21 @@
--safe-left: max(env(safe-area-inset-left, 0px), var(--tauri-inset-left, 0px));
--safe-top: max(env(safe-area-inset-top, 0px), var(--tauri-inset-top, 0px));
- /* Horizontal gutter shared by the full-frame mobile chrome: the dock row,
- header island strip, and accessory-region contributions all pad with
- this so their edges line up. Use `px-(--mobile-chrome-gutter)`. */
- --mobile-chrome-gutter: 0.75rem;
+ /* Mobile chrome sizing knobs. Literal px, not --spacing-derived rem:
+ chrome must not track the OS text-size setting. */
+ /* Gutter shared by the full-frame mobile chrome: the dock row, header
+ island strip, and accessory-region contributions all pad with this so
+ their edges line up, and the bottom-chrome stack reuses it for its gap
+ and bottom inset. Use `px-(--mobile-chrome-gutter)`. */
+ --mobile-chrome-gutter: 12px;
+ /* Gap within the dock row: between its islands and between the buttons
+ inside the compact dock island. */
+ --mobile-chrome-gap: 12px;
+ /* Dock buttons and touch-menu triggers; the compact dock island matches
+ its height to this. */
+ --mobile-chrome-button-size: 46px;
+ /* Icon inside a dock button / touch-menu trigger. */
+ --mobile-chrome-icon-size: 27px;
/* chat vars */
--left-of-connector: calc(var(--message-padding-x) + var(--user-icon-width) * 0.5);
@@ -475,7 +486,7 @@ body.tauri-ios {
utility so it composes with variants — `mobile:island` — instead of
hand-prefixing each part. */
@utility island {
- @apply bg-chrome text-ink ring dark-mode:ring-edge light-mode:ring-panel light-mode:shadow-[0_4px_20px_8px_oklch(0.15_0_0/0.07)];
+ @apply min-h-[40px] min-w-[40px] bg-chrome text-ink ring dark-mode:ring-edge light-mode:ring-panel light-mode:shadow-[0_4px_20px_8px_oklch(0.15_0_0/0.07)];
}
[data-press-pulse] {
@@ -930,7 +941,7 @@ a {
@keyframes float-region-in {
from {
opacity: 0;
- transform: translateY(0.5rem);
+ transform: translateY(8px);
}
}