Skip to content

fix(web): let ⌘← and ⌘→ go back and forward from the Agent Floor - #306

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/393-the-browser-s-back-and-forward-doesn-t-w
Oct 28, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/393-the-browser-s-back-and-forward-doesn-t-w

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The Agent Floor puts the focus in its task box as it opens (since #127), and in a text field Chrome, Safari and Firefox on a Mac use ⌘← and ⌘→ to move the caret to the start or the end of the line instead of going back and forward. So once back or forward landed on the Agent Floor, ⌘← and ⌘→ did nothing there, while the browser's buttons, which don't depend on the focus, kept working. Now, while the task box is empty, ⌘← and ⌘→ in it go back and forward on Apple's systems; with text in it they move the caret as in any field. Other systems are unaffected: their browsers go back with Alt+←, which works in a field too. Getting started says so.

New tests in web/src/lib/task-box.test.tsx cover the empty box, a box with text, ⇧, ⌥ and input methods, and Windows; the one for the empty box fails without the fix. cargo xtask check web passes. In headless Chromium and WebKit against cargo xtask dev, with a Mac's user agent, ⌘→ and ⌘← in the empty box went forward to a session and back to Settings, and with a task written in the box they left the page alone. Headless browsers don't run their own ⌘← and ⌘→ outside fields, so those steps used history.back() and history.forward().

Worth confirming

  • Decision: With text in the box, a draft kept from an earlier visit included, ⌘← and ⌘→ move the caret rather than leave the page, so from a box with text they go back and forward only once it is empty again (the browser's buttons always do). The alternative was to stop focusing the box when back or forward opens the Agent Floor, which would also change what the buttons do.

fctl session

The Agent Floor puts the focus in its task box as it opens, and in a text
field Chrome, Safari and Firefox on a Mac take ⌘← and ⌘→ to move the caret
to the start or the end of the line rather than to go back and forward. So
once back or forward landed on the Agent Floor, ⌘← and ⌘→ did nothing
there, while the browser's buttons, which don't care where the focus is,
still worked.

While the box is empty, with no caret to move, ⌘← and ⌘→ in it now go back
and forward, on Apple's systems. With text in it, they move its caret as in
any field. Other systems are left alone: their browsers go back with Alt+←,
which works in a field too.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 28, 2026 13:49
@kalaspuff
kalaspuff merged commit 06e5af4 into main Oct 28, 2026
10 checks passed
@kalaspuff
kalaspuff deleted the fctl/393-the-browser-s-back-and-forward-doesn-t-w branch October 28, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant