fix(browser): match toolbar icons to app chrome and make annotate an icon (#43269)

Drop the address field's 3px focus ring for a hairline border, size the
toolbar buttons like other pane headers (24px, 14px muted icons), and
replace the Annotate split button with one icon. Grab and Draw move to
the icon's right-click menu and the top of the ⋯ menu.
This commit is contained in:
Kelvin Amoaba
2026-11-16 21:55:15 +00:00
committed by GitHub
parent a9e6b80aa4
commit 5612349f6c
23 changed files with 295 additions and 205 deletions
@@ -12,7 +12,6 @@ export type MarkupDrawButtonProps = {
active?: boolean
/** Explicitly gate on pane activity: a hidden trigger anchors portaled content at the viewport origin. */
surfaceActive: boolean
className?: string
}
/** Standalone Draw for surfaces without the element picker (remote and client-hosted pages). */
@@ -20,8 +19,7 @@ export function MarkupDrawButton({
onClick,
disabled,
active,
surfaceActive,
className
surfaceActive
}: MarkupDrawButtonProps): React.JSX.Element {
const t = useTranslate()
const label = t('auto.components.browser-pane.markup.drawButton', 'Draw on screenshot')
@@ -40,10 +38,9 @@ export function MarkupDrawButton({
{/* Why: wrap in a span so the tooltip still fires when disabled. */}
<span className="inline-flex">
<Button
size="icon"
variant={active ? 'default' : 'ghost'}
size="icon-xs"
variant={active ? 'default' : 'muted-field-icon'}
className={cn(
className ?? 'h-7 w-7',
active && 'bg-foreground/80 text-background hover:bg-foreground/90',
showHint && 'ring-2 ring-ring/45 ring-offset-1 ring-offset-background'
)}
@@ -52,7 +49,7 @@ export function MarkupDrawButton({
aria-label={label}
aria-pressed={active}
>
<PenTool className="size-4" />
<PenTool className="size-3.5" />
</Button>
</span>
</TooltipTrigger>
@@ -349,7 +349,7 @@ export default function BrowserAddressBar({
ref={setAddressBarFormRef}
data-orca-browser-address-bar-overlay={overlay ? 'true' : undefined}
className={cn(
'flex items-center gap-2 rounded-lg bg-muted px-2.5 transition-colors focus-within:bg-background focus-within:ring-[3px] focus-within:ring-ring/50',
'flex items-center gap-2 rounded-lg border border-transparent bg-muted px-2.5 transition-colors focus-within:border-border',
// Position against the toolbar row so the overlay spans it, not the squeezed slot.
overlay
? 'absolute inset-x-2 top-1/2 z-30 h-8 -translate-y-1/2 bg-background shadow-[0_10px_24px_rgba(0,0,0,0.18)]'
@@ -362,7 +362,7 @@ export default function BrowserAddressBar({
submitTypedValue()
}}
>
{leadingIcon ?? <Globe className="size-4 shrink-0 text-muted-foreground" />}
{leadingIcon ?? <Globe className="size-3.5 shrink-0 text-muted-foreground" />}
<Input
ref={inputRef}
value={value}
@@ -40,7 +40,7 @@ import {
import '@/lib/browser/documents/file-preview'
import { convertBrowserPageToWorkspaceDoc } from '@/lib/browser/documents/file-preview-page-conversion'
import type { GrabIntent } from '../../../../../shared/browser/element-grab/browser-grab-types'
import type { BrowserChromeNoteActions } from './toolbar/browser-annotate-split-button'
import type { BrowserChromeNoteActions } from './toolbar/browser-annotate-tool-button'
/** Binds the shared browser chrome to a browsing page: an editable address bar and session tools. */
export function BrowserPageToolbar({
@@ -129,9 +129,6 @@ export function BrowserPageToolbar({
externalUrl: string | null
}): React.JSX.Element {
const annotateElementShortcut = useShortcutLabel('browser.annotateElement')
const browserTourStep = useAppStore((state) =>
state.activeContextualTourId === 'browser' ? state.activeContextualTourStepIndex : null
)
const localHtmlFilePath = getShareableBrowserArtifactFile(currentBrowserUrl)?.filePath ?? null
// Why the URL check first: every other page skips the workspace-owner lookup on each store write.
const canOpenSourceFile = useAppStore(
@@ -156,7 +153,6 @@ export function BrowserPageToolbar({
<BrowserChromeToolbar
closeTabOwner={{ worktreeId, browserPageId }}
showTourAnchors
pinAnnotateLabel={browserTourStep === 0}
controls={{
canGoBack: canGoBack || Boolean(convertedFrom),
canGoForward: canGoForward || Boolean(convertedTo),
@@ -73,7 +73,7 @@ function ExtensionIcon({ action }: { action: BrowserExtensionToolbarAction }): R
className={cn('size-4 shrink-0', !action.enabled && 'opacity-40 grayscale')}
/>
) : (
<Puzzle className="size-4 shrink-0 text-muted-foreground" />
<Puzzle className="size-3.5 shrink-0 text-muted-foreground" />
)
}
@@ -114,9 +114,9 @@ function PinnedActionButton({
<ContextMenuTrigger asChild>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className="relative h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
className="relative"
aria-label={action.title}
aria-disabled={!action.enabled}
data-browser-extension-pinned={pinnedButtonKey(browserPageId, action.extensionId)}
@@ -255,7 +255,7 @@ export function BrowserExtensionsMenuSub({
}}
>
<DropdownMenuSubTrigger>
<Puzzle className="mr-2 size-3.5" />
<Puzzle className="size-3.5" />
{t('browser.extensions.menu', 'Extensions')}
</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="w-64" data-browser-page-menu-id={browserPageId}>
@@ -126,7 +126,7 @@ export function SshEgressIndicator({
runtimeEnvironments
)
if (!routeEligibility) {
return <Globe className="size-4 shrink-0 text-muted-foreground" />
return <Globe className="size-3.5 shrink-0 text-muted-foreground" />
}
const { targetId, eligible: routed } = routeEligibility
const hostLabel = environment
@@ -136,7 +136,7 @@ export function SshEgressIndicator({
targetId)
return (
<EgressIndicatorButton
icon={routed ? <Server className="size-4" /> : <Monitor className="size-4" />}
icon={routed ? <Server className="size-3.5" /> : <Monitor className="size-3.5" />}
egress={routed ? 'ssh' : 'local'}
description={
routed
@@ -178,7 +178,7 @@ export function RemoteRuntimeEgressIndicator({
const clientHosted = presentation === 'client-hosted'
return (
<EgressIndicatorButton
icon={<Server className="size-4" />}
icon={<Server className="size-3.5" />}
egress="remote"
description={
clientHosted
@@ -61,7 +61,7 @@ export function BrowserToolbarProfileSub({
return (
<DropdownMenuSub open={forceOpen || open} onOpenChange={setOpen}>
<DropdownMenuSubTrigger>
<UserRound className="mr-2 size-3.5" />
<UserRound className="size-3.5" />
{t('browser.toolbar.profile', 'Profile')}
<span className="ml-auto truncate pl-2 text-xs text-muted-foreground">
{translateBrowserSessionProfileLabel(currentProfile?.label, effectiveProfileId)}
@@ -77,7 +77,7 @@ export function BrowserToolbarProfileSub({
onSelect={() => onSwitchProfile(profile.id === 'default' ? null : profile.id)}
>
<Check
className={`mr-2 size-3.5 shrink-0 ${isSelectedProfile ? 'opacity-100' : 'opacity-0'}`}
className={`size-3.5 shrink-0 ${isSelectedProfile ? 'opacity-100' : 'opacity-0'}`}
/>
<span className="truncate">
{translateBrowserSessionProfileLabel(profile.label, profile.id)}
@@ -93,7 +93,7 @@ export function BrowserToolbarProfileSub({
})}
<DropdownMenuSeparator />
<DropdownMenuItem onSelect={onNewProfile}>
<Plus className="mr-2 size-3.5" />
<Plus className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.cf7cdc67ef', 'New Profile…')}
</DropdownMenuItem>
<DropdownMenuSub
@@ -111,7 +111,7 @@ export function BrowserToolbarProfileSub({
}
data-contextual-tour-target="browser-import-cookies-control"
>
<Import className="mr-2 size-3.5" />
<Import className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.2293adf620', 'Import Cookies')}
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
@@ -1,15 +1,7 @@
import {
Check,
ChevronDown,
Copy,
Crosshair,
MessageSquarePlus,
PenTool,
Trash2
} from 'lucide-react'
import { useState } from 'react'
import { Check, Copy, Crosshair, MessageSquarePlus, PenTool, Trash2 } from 'lucide-react'
import type { LucideIcon } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { ButtonGroup } from '@/components/ui/button-group'
import {
DropdownMenu,
DropdownMenuContent,
@@ -84,22 +76,52 @@ function MenuToolRow({
)
}
/** Grab, Annotate and Draw are one mode with three flavours: Annotate on the button, the rest in its menu. */
export function BrowserAnnotateSplitButton({
/** Grab and Draw rows, shared by the annotate icon's right-click menu and each surface's ⋯ menu. */
export function BrowserAnnotateToolMenuItems({
tools,
markup,
onDraw
}: {
tools: BrowserChromeElementTools
markup: BrowserChromeMarkupTool
onDraw?: () => void
}): React.JSX.Element {
const t = useTranslate()
return (
<>
<MenuToolRow
icon={Crosshair}
label={t('auto.components.browser.pane.BrowserPane.fdfc7fe0ef', 'Grab page element')}
shortcut={tools.grabShortcutLabel}
checked={tools.activeIntent === 'copy'}
disabled={tools.disabled}
onSelect={() => tools.onStartIntent('copy')}
/>
<MenuToolRow
icon={PenTool}
label={t('auto.components.browser-pane.markup.drawButton', 'Draw on screenshot')}
checked={markup.active}
disabled={markup.disabled}
onSelect={onDraw ?? markup.onToggle}
/>
</>
)
}
/** Grab, Annotate and Draw are one mode with three flavours: click annotates, right-click offers the rest. */
export function BrowserAnnotateToolButton({
tools,
markup,
notes,
compact,
showTourAnchors
}: {
tools: BrowserChromeElementTools
markup: BrowserChromeMarkupTool
notes?: BrowserChromeNoteActions | null
/** Narrow rows drop the label; the icon and count stay. */
compact: boolean
showTourAnchors: boolean
}): React.JSX.Element {
const t = useTranslate()
const [menuOpen, setMenuOpen] = useState(false)
const { showHint, dismissHint } = useMarkupDrawHintState(
markup.canShowDiscoveryHint,
!markup.disabled && !markup.active
@@ -108,8 +130,6 @@ export function BrowserAnnotateSplitButton({
'auto.components.browser.pane.BrowserPane.fc9be38f6f',
'Annotate page element'
)
const grabLabel = t('auto.components.browser.pane.BrowserPane.fdfc7fe0ef', 'Grab page element')
const drawLabel = t('auto.components.browser-pane.markup.drawButton', 'Draw on screenshot')
const mode = markup.active
? { icon: PenTool, label: t('browser.toolbar.draw', 'Draw') }
@@ -134,7 +154,6 @@ export function BrowserAnnotateSplitButton({
markup.onToggle()
}
const hasNotes = Boolean(notes) && tools.annotationCount > 0
const menuHasActions = !tools.disabled || !markup.disabled || hasNotes
const primaryTooltip = active
? mode.label
: tools.annotateShortcutLabel
@@ -156,90 +175,76 @@ export function BrowserAnnotateSplitButton({
? { 'data-contextual-tour-target': 'browser-annotation-control' }
: {})}
>
<ButtonGroup>
<Tooltip>
<DropdownMenu modal={false} open={menuOpen} onOpenChange={setMenuOpen}>
{/* Why: suppress the tooltip while the menu is open — both anchor below the button and would overlap. */}
<Tooltip open={menuOpen ? false : undefined}>
<TooltipTrigger asChild>
<Button
variant={active ? 'default' : 'outline'}
size="sm"
onClick={onPrimary}
disabled={!active && tools.disabled}
aria-label={annotateLabel}
aria-pressed={active}
>
<ModeIcon />
{compact ? null : <span>{mode.label}</span>}
{tools.annotationCount > 0 ? (
<span
className={cn(
'flex min-w-4 items-center justify-center rounded-full px-1 text-3xs leading-4 font-semibold',
active
? 'bg-primary-foreground text-primary'
: 'bg-primary text-primary-foreground'
)}
>
{tools.annotationCount}
</span>
) : null}
</Button>
<DropdownMenuTrigger asChild>
<Button
variant={active ? 'default' : 'muted-field-icon'}
size="icon-xs"
className="relative"
disabled={!active && tools.disabled}
aria-label={annotateLabel}
aria-pressed={active}
// Same gestures as Reload: left click runs the tool, right click opens the menu.
onPointerDown={(event) => {
if (event.button === 0) {
event.preventDefault()
}
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
onPrimary()
}
}}
onClick={onPrimary}
onContextMenu={(event) => {
event.preventDefault()
setMenuOpen(true)
}}
>
<ModeIcon className="size-3.5" />
{tools.annotationCount > 0 ? (
<span className="pointer-events-none absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-0.5 text-3xs leading-none font-semibold text-primary-foreground ring-2 ring-background">
{tools.annotationCount}
</span>
) : null}
</Button>
</DropdownMenuTrigger>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={4}>
{primaryTooltip}
</TooltipContent>
</Tooltip>
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button
variant={active ? 'default' : 'outline'}
size="icon-sm"
disabled={!menuHasActions}
aria-label={t('browser.toolbar.annotateOptions', 'More annotate tools')}
>
<ChevronDown />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-64">
<MenuToolRow
icon={MessageSquarePlus}
label={annotateLabel}
shortcut={tools.annotateShortcutLabel}
checked={tools.activeIntent === 'annotate'}
disabled={tools.disabled}
onSelect={() => tools.onStartIntent('annotate')}
/>
<MenuToolRow
icon={Crosshair}
label={grabLabel}
shortcut={tools.grabShortcutLabel}
checked={tools.activeIntent === 'copy'}
disabled={tools.disabled}
onSelect={() => tools.onStartIntent('copy')}
/>
<MenuToolRow
icon={PenTool}
label={drawLabel}
checked={markup.active}
disabled={markup.disabled}
onSelect={startDraw}
/>
{notes && hasNotes ? (
<>
<DropdownMenuSeparator />
<MenuToolRow
icon={Copy}
label={t('browser.toolbar.copyAllNotes', 'Copy all notes')}
onSelect={notes.onCopyAll}
/>
<MenuToolRow
icon={Trash2}
label={t('browser.toolbar.clearNotes', 'Clear notes')}
onSelect={notes.onClear}
/>
</>
) : null}
</DropdownMenuContent>
</DropdownMenu>
</ButtonGroup>
<DropdownMenuContent align="end" className="w-64">
<MenuToolRow
icon={MessageSquarePlus}
label={annotateLabel}
shortcut={tools.annotateShortcutLabel}
checked={tools.activeIntent === 'annotate'}
disabled={tools.disabled}
onSelect={() => tools.onStartIntent('annotate')}
/>
<BrowserAnnotateToolMenuItems tools={tools} markup={markup} onDraw={startDraw} />
{notes && hasNotes ? (
<>
<DropdownMenuSeparator />
<MenuToolRow
icon={Copy}
label={t('browser.toolbar.copyAllNotes', 'Copy all notes')}
onSelect={notes.onCopyAll}
/>
<MenuToolRow
icon={Trash2}
label={t('browser.toolbar.clearNotes', 'Clear notes')}
onSelect={notes.onClear}
/>
</>
) : null}
</DropdownMenuContent>
</DropdownMenu>
</span>
</MarkupDrawHintPopover>
)
@@ -0,0 +1,116 @@
import { useRef } from 'react'
import { defineFixture } from '../../../../component-fixtures/component-fixture'
import BrowserAddressBar from '../address-bar/BrowserAddressBar'
import { DocPreviewOverflowMenu } from '../../workspace-doc/doc-preview-overflow-menu'
import { BrowserChromeToolbar } from './browser-chrome-toolbar'
import type { GrabIntent } from '../../../../../../shared/browser/element-grab/browser-grab-types'
const noop = (): void => {}
function Toolbar({
annotationCount = 0,
activeIntent = null,
drawing = false
}: {
annotationCount?: number
activeIntent?: GrabIntent | null
drawing?: boolean
}): React.JSX.Element {
const inputRef = useRef<HTMLInputElement>(null)
return (
<BrowserChromeToolbar
closeTabOwner={{ worktreeId: 'fixture', browserPageId: 'fixture-page' }}
controls={{
canGoBack: true,
canGoForward: false,
goBack: noop,
goForward: noop,
reload: noop,
navigate: noop
}}
addressSlot={
<BrowserAddressBar
pageId="fixture-page"
value="localhost:5173/settings"
inputRef={inputRef}
onChange={noop}
onSubmit={noop}
onNavigate={noop}
/>
}
elementTools={{
activeIntent,
onStartIntent: noop,
disabled: false,
grabShortcutLabel: '⌘C',
annotateShortcutLabel: '⇧⌘C',
annotationCount
}}
markup={{ active: drawing, disabled: false, onToggle: noop, canShowDiscoveryHint: false }}
notes={{ onCopyAll: noop, onClear: noop }}
overflowMenu={(overflow) => (
<DocPreviewOverflowMenu
onReload={noop}
onHardReload={noop}
onOpenSource={noop}
onOpenExternally={noop}
onCopyPath={noop}
onCopyRelativePath={noop}
overflow={overflow}
/>
)}
/>
)
}
const settle = (): Promise<void> => new Promise((resolve) => setTimeout(resolve, 150))
export const idle = defineFixture({ width: 640, render: () => <Toolbar /> })
export const withNotes = defineFixture({
width: 640,
render: () => <Toolbar annotationCount={3} />
})
export const annotating = defineFixture({
width: 640,
render: () => <Toolbar annotationCount={3} activeIntent="annotate" />
})
export const drawing = defineFixture({ width: 640, render: () => <Toolbar drawing /> })
export const addressFocused = defineFixture({
width: 640,
render: () => <Toolbar annotationCount={3} />,
interact: async (frame) => {
frame.querySelector<HTMLInputElement>('[data-orca-browser-address-bar="true"]')?.focus()
await settle()
}
})
export const annotateMenu = defineFixture({
width: 640,
render: () => <Toolbar annotationCount={3} />,
interact: async (frame) => {
frame
.querySelector('button[aria-label="Annotate page element"]')
?.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true }))
await settle()
}
})
export const overflowMenu = defineFixture({
width: 640,
render: () => <Toolbar annotationCount={3} />,
interact: async (frame) => {
frame.querySelector('button[aria-label="Preview options"]')?.dispatchEvent(
new PointerEvent('pointerdown', {
bubbles: true,
cancelable: true,
button: 0,
pointerType: 'mouse'
})
)
await settle()
}
})
@@ -5,17 +5,14 @@ import {
BrowserNavigationControlRow,
type BrowserNavigationControls
} from './browser-navigation-control-row'
import { useBrowserChromeToolFold } from './use-browser-chrome-tool-fold'
import {
BROWSER_CHROME_FOLD_ORDER,
useBrowserChromeToolFold,
type BrowserChromeFoldStage
} from './use-browser-chrome-tool-fold'
import {
BrowserAnnotateSplitButton,
BrowserAnnotateToolButton,
BrowserAnnotateToolMenuItems,
type BrowserChromeElementTools,
type BrowserChromeMarkupTool,
type BrowserChromeNoteActions
} from './browser-annotate-split-button'
} from './browser-annotate-tool-button'
import { useFloatingSplitBrowserClose } from './use-floating-split-browser-close'
export type BrowserChromeToolAction = {
@@ -29,6 +26,8 @@ export type BrowserChromeOverflowMenuProps = {
/** Run after menu close without focus return; focusing the ⋯ trigger would immediately dismiss a new popover or dialog. */
deferUntilClose: (action: () => void) => void
onMenuCloseAutoFocus: (event: Event) => void
/** Grab and Draw, which the annotate icon otherwise shows only on right-click. */
annotateToolItems: React.ReactNode
}
/**
@@ -47,8 +46,7 @@ export function BrowserChromeToolbar({
shareControl,
overflowMenu,
closeTabOwner,
showTourAnchors = false,
pinAnnotateLabel = false
showTourAnchors = false
}: {
controls: BrowserNavigationControls
addressSlot: React.ReactNode
@@ -71,8 +69,6 @@ export function BrowserChromeToolbar({
closeTabOwner: { worktreeId: string; browserPageId: string }
/** Only the browsing pane anchors the contextual tour; a second anchor would steal its steps. */
showTourAnchors?: boolean
/** Keeps the tour's target fully labelled while it is pointed at. */
pinAnnotateLabel?: boolean
}): React.JSX.Element {
const closeTab = useFloatingSplitBrowserClose(
closeTabOwner.worktreeId,
@@ -80,14 +76,7 @@ export function BrowserChromeToolbar({
)
const rowRef = useRef<HTMLDivElement>(null)
const overflowTriggerRef = useRef<HTMLButtonElement>(null)
const present: Record<BrowserChromeFoldStage, boolean> = {
extensions: extensionActions != null,
'annotate-label': !pinAnnotateLabel
}
const folded = useBrowserChromeToolFold(
rowRef,
BROWSER_CHROME_FOLD_ORDER.filter((stage) => present[stage])
)
const folded = useBrowserChromeToolFold(rowRef, extensionActions == null ? [] : ['extensions'])
const afterMenuCloseRef = useRef<(() => void) | null>(null)
const deferUntilClose = (action: () => void): void => {
@@ -113,11 +102,10 @@ export function BrowserChromeToolbar({
showTourAnchors={showTourAnchors}
>
{shareControl}
<BrowserAnnotateSplitButton
<BrowserAnnotateToolButton
tools={elementTools}
markup={markup}
notes={notes}
compact={folded.has('annotate-label')}
showTourAnchors={showTourAnchors}
/>
<span className="flex shrink-0 items-center">
@@ -125,22 +113,22 @@ export function BrowserChromeToolbar({
{overflowMenu({
triggerRef: overflowTriggerRef,
deferUntilClose,
onMenuCloseAutoFocus
onMenuCloseAutoFocus,
annotateToolItems: <BrowserAnnotateToolMenuItems tools={elementTools} markup={markup} />
})}
</span>
{closeTab ? (
<>
<span className="mx-0.5 h-4 w-px shrink-0 bg-border" aria-hidden />
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
onClick={closeTab.onSelect}
title={closeTab.label}
aria-label={closeTab.label}
disabled={closeTab.disabled}
>
<X className="size-4" />
<X className="size-3.5" />
</Button>
</>
) : null}
@@ -49,34 +49,31 @@ export function BrowserNavigationControlRow({
{...(showTourAnchors ? { 'data-contextual-tour-target': 'browser-toolbar' } : {})}
>
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
onClick={controls.goBack}
disabled={!controls.canGoBack}
aria-label={t('browser.navigation.back', 'Back')}
>
<ArrowLeft className="size-4" />
<ArrowLeft className="size-3.5" />
</Button>
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
onClick={controls.goForward}
disabled={!controls.canGoForward}
aria-label={t('browser.navigation.forward', 'Forward')}
>
<ArrowRight className="size-4" />
<ArrowRight className="size-3.5" />
</Button>
{reloadControl ?? (
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
onClick={controls.reload}
aria-label={reloadLabel ?? t('browser.navigation.reload', 'Reload')}
>
{reloadShowsStop ? <X className="size-4" /> : <RefreshCw className="size-4" />}
{reloadShowsStop ? <X className="size-3.5" /> : <RefreshCw className="size-3.5" />}
</Button>
)}
@@ -45,9 +45,8 @@ export function BrowserReloadControl({
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
aria-label={label}
// Prevent Radix left-click opening so the primary action remains reload and only right-click opens the menu.
onPointerDown={(e) => {
@@ -68,7 +67,7 @@ export function BrowserReloadControl({
onMenuOpenChange(true)
}}
>
{showStop ? <X className="size-4" /> : <RefreshCw className="size-4" />}
{showStop ? <X className="size-3.5" /> : <RefreshCw className="size-3.5" />}
</Button>
</DropdownMenuTrigger>
</TooltipTrigger>
@@ -96,9 +96,8 @@ export function BrowserToolbarMenuDropdown({
<DropdownMenuTrigger asChild>
<Button
ref={overflow.triggerRef}
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
title={menuLabel}
aria-label={menuLabel}
data-contextual-tour-target={
@@ -106,7 +105,7 @@ export function BrowserToolbarMenuDropdown({
}
data-browser-profile-id={profile.effectiveProfileId}
>
<Ellipsis className="size-4" />
<Ellipsis className="size-3.5" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -115,18 +114,20 @@ export function BrowserToolbarMenuDropdown({
data-browser-page-menu-id={browserPageId}
onCloseAutoFocus={overflow.onMenuCloseAutoFocus}
>
{overflow.annotateToolItems}
<DropdownMenuSeparator />
<DropdownMenuItem
// Why deferred: focus returning to the ⋯ trigger would pull it out of the find field.
onSelect={() => overflow.deferUntilClose(pageActions.onFind)}
>
<Search className="mr-2 size-3.5" />
<Search className="size-3.5" />
{t('browser.toolbar.findOnPage', 'Find on page')}
{findShortcut ? <DropdownMenuShortcut>{findShortcut}</DropdownMenuShortcut> : null}
</DropdownMenuItem>
<BrowserToolbarZoomRow display={siteDisplay} onZoom={onZoomPage} />
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<Monitor className="mr-2 size-3.5" />
<Monitor className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.e5d31de1a9', 'Viewport Size')}
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
@@ -160,21 +161,21 @@ export function BrowserToolbarMenuDropdown({
<DropdownMenuSeparator />
<DropdownMenuItem onSelect={pageActions.onHardReload}>
<RotateCcw className="mr-2 size-3.5" />
<RotateCcw className="size-3.5" />
{t('auto.components.browser.pane.BrowserPane.a1f3c2e4b5', 'Hard Reload')}
{hardReloadShortcut ? (
<DropdownMenuShortcut>{hardReloadShortcut}</DropdownMenuShortcut>
) : null}
</DropdownMenuItem>
<DropdownMenuItem onSelect={pageActions.onOpenDevTools}>
<SquareCode className="mr-2 size-3.5" />
<SquareCode className="size-3.5" />
{t('auto.components.browser.pane.BrowserPane.ec75d0c412', 'Open browser devtools')}
</DropdownMenuItem>
<DropdownMenuItem
disabled={!pageActions.onOpenExternal}
onSelect={() => pageActions.onOpenExternal?.()}
>
<ExternalLink className="mr-2 size-3.5" />
<ExternalLink className="size-3.5" />
{t('auto.components.browser.pane.BrowserPane.0f41bf80c7', 'Open in default browser')}
</DropdownMenuItem>
@@ -193,7 +194,7 @@ export function BrowserToolbarMenuDropdown({
)
}
>
<History className="mr-2 size-3.5" />
<History className="size-3.5" />
{t('browser.history.menuItem', 'History')}
{historyShortcut ? <DropdownMenuShortcut>{historyShortcut}</DropdownMenuShortcut> : null}
</DropdownMenuItem>
@@ -203,7 +204,7 @@ export function BrowserToolbarMenuDropdown({
useAppStore.getState().openSettingsPage()
}}
>
<Settings className="mr-2 size-3.5" />
<Settings className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.a771c2b6c8', 'Browser Settings…')}
</DropdownMenuItem>
</DropdownMenuContent>
@@ -57,7 +57,7 @@ export function BrowserToolbarZoomRow({
}
}}
>
<ZoomIn className="mr-2 size-3.5" />
<ZoomIn className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.zoom', 'Zoom')}
<span className="ml-auto flex items-center">
<Button
@@ -119,7 +119,7 @@ export function BrowserToolbarAppearanceSub({
return (
<DropdownMenuSub>
<DropdownMenuSubTrigger disabled={!display?.site}>
<SunMoon className="mr-2 size-3.5" />
<SunMoon className="size-3.5" />
{t('auto.components.browser.pane.BrowserToolbarMenu.appearance', 'Appearance')}
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
@@ -1,13 +1,8 @@
import { useLayoutEffect, useRef, useState, type RefObject } from 'react'
import { BROWSER_CHROME_ADDRESS_SLOT_ATTRIBUTE } from '../address-bar/browser-chrome-address-slot'
/** Compaction stages run in order: pinned extensions fold into ⋯ first, then Annotate drops its label. */
export type BrowserChromeFoldStage = 'extensions' | 'annotate-label'
export const BROWSER_CHROME_FOLD_ORDER: readonly BrowserChromeFoldStage[] = [
'extensions',
'annotate-label'
]
/** Compaction stages run in order; today only pinned extensions fold into ⋯. */
export type BrowserChromeFoldStage = 'extensions'
/** Below this the URL stops being readable, so tools fold before the address shrinks further. */
export const BROWSER_CHROME_ADDRESS_MIN_WIDTH_PX = 120
@@ -85,13 +85,12 @@ export function RemoteBrowserPageToolbar({
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
aria-label={t('auto.components.browser.pane.BrowserPane.0e080d820e', 'Reload')}
onClick={onReload}
>
<RefreshCw className="size-4" />
<RefreshCw className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={4}>
@@ -103,9 +102,8 @@ export function RemoteBrowserPageToolbar({
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className="h-7 w-7 opacity-50"
size="icon-xs"
variant="muted-field-icon"
aria-disabled="true"
aria-label={t(
'auto.components.browser.pane.BrowserPane.deb5293610',
@@ -115,7 +113,7 @@ export function RemoteBrowserPageToolbar({
event.preventDefault()
}}
>
<MessageSquarePlus className="size-4" />
<MessageSquarePlus className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={4}>
@@ -130,7 +128,6 @@ export function RemoteBrowserPageToolbar({
disabled={!frameUrl}
active={markup.isActive}
surfaceActive={isActive}
className="h-7 w-7"
/>
</BrowserNavigationControlRow>
)
@@ -128,7 +128,8 @@ export function buildDocPreviewShareControl(
return (
<ArtifactPublishButton
sourceKey={sourceKey}
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
createRequest={() => readDocPreviewArtifactRequest(location, filePath, sourceKey)}
/>
)
@@ -36,9 +36,9 @@ export function DocPreviewDocumentChip({
className="@container flex min-w-0 flex-1 items-center gap-2 overflow-hidden rounded-lg bg-muted px-2.5 text-left hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none"
>
{copied ? (
<Check className="size-4 shrink-0 text-muted-foreground" />
<Check className="size-3.5 shrink-0 text-muted-foreground" />
) : (
<FileCode2 className="size-4 shrink-0 text-muted-foreground" />
<FileCode2 className="size-3.5 shrink-0 text-muted-foreground" />
)}
{/* Match file-tree emphasis: muted directory, normal filename. */}
<span className="min-w-0 flex-1 truncate text-sm">
@@ -35,18 +35,19 @@ export function DocPreviewOverflowMenu({
<DropdownMenuTrigger asChild>
<Button
ref={overflow.triggerRef}
size="icon"
variant="ghost"
className="h-7 w-7"
size="icon-xs"
variant="muted-field-icon"
aria-label={t(
'auto.components.editor.HtmlDocPreview.previewMenuControl',
'Preview options'
)}
>
<MoreHorizontal className="size-4" />
<MoreHorizontal className="size-3.5" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" onCloseAutoFocus={overflow.onMenuCloseAutoFocus}>
{overflow.annotateToolItems}
<DropdownMenuSeparator />
<DropdownMenuItem onSelect={onReload}>
<RefreshCw className="size-3.5" />
{t('auto.components.browser.pane.BrowserPane.0e080d820e', 'Reload')}
@@ -1,6 +1,6 @@
import { useState } from 'react'
import { BrowserChromeToolbar } from '@/components/browser-pane/assemble-chrome/toolbar/browser-chrome-toolbar'
import type { BrowserChromeElementTools } from '@/components/browser-pane/assemble-chrome/toolbar/browser-annotate-split-button'
import type { BrowserChromeElementTools } from '@/components/browser-pane/assemble-chrome/toolbar/browser-annotate-tool-button'
import { BrowserReloadControl } from '@/components/browser-pane/assemble-chrome/toolbar/browser-reload-control'
import { useTranslate } from '@/i18n/use-translate'
import { DocPreviewAddressEdit } from './doc-preview-address-edit'
@@ -8,7 +8,7 @@ import { useBrowserPageGrabAnnotations } from '@/components/browser-pane/annotat
import { useBrowserPageMarkupCapture } from '@/components/browser-pane/annotate/capture/use-browser-page-markup-capture'
import { useGrabMode } from '@/components/browser-pane/annotate/grab/useGrabMode'
import type { BrowserOverlayViewport } from '@/components/browser-pane/describe-page/browser-annotation-geometry'
import type { BrowserChromeElementTools } from '@/components/browser-pane/assemble-chrome/toolbar/browser-annotate-split-button'
import type { BrowserChromeElementTools } from '@/components/browser-pane/assemble-chrome/toolbar/browser-annotate-tool-button'
/** Use the stable browser page ID for annotations and tools so replacing the guest grant preserves both. */
export function useDocPreviewGuestTools({
-1
View File
@@ -562,7 +562,6 @@
"annotate": "Annotate",
"grab": "Grab",
"draw": "Draw",
"annotateOptions": "More annotate tools",
"copyAllNotes": "Copy all notes",
"clearNotes": "Clear notes",
"resetZoom": "Reset zoom",
-1
View File
@@ -21984,7 +21984,6 @@
"annotate": "注釈",
"grab": "取得",
"draw": "描き込み",
"annotateOptions": "その他の注釈ツール",
"copyAllNotes": "すべてのメモをコピー",
"clearNotes": "メモをクリア",
"resetZoom": "ズームをリセット",
-1
View File
@@ -22371,7 +22371,6 @@
"annotate": "注释",
"grab": "抓取",
"draw": "绘制",
"annotateOptions": "更多注释工具",
"copyAllNotes": "复制所有注释",
"clearNotes": "清除注释",
"resetZoom": "重置缩放",