Skip to content

Fix: Allow native Cmd+Up/Down cursor movement when user has typed text#3246

Merged
angiejones merged 2 commits intoblock:mainfrom
aharvard:feature/improve-chat-input-history-nav-ux
Jul 7, 2025
Merged

Fix: Allow native Cmd+Up/Down cursor movement when user has typed text#3246
angiejones merged 2 commits intoblock:mainfrom
aharvard:feature/improve-chat-input-history-nav-ux

Conversation

@aharvard
Copy link
Collaborator

@aharvard aharvard commented Jul 3, 2025

This PR implements an idea shared by @wallerdev via internal Block Slack.

Problem

Currently, when users type text in the chat input field and press Cmd+Up (or Ctrl+Up), the text gets replaced with the previous message from history instead of moving the cursor to the beginning of the text. This conflicts with native macOS behavior and user expectations, especially for users familiar with apps like Slack where Cmd+Up moves the cursor when there's text in the input.

Solution

This PR implements a smart solution that distinguishes between text that comes from history navigation vs. text that the user has actively typed:

  • When input is empty: Cmd+Up/Down continues to work for history navigation (preserves existing behavior)
  • When text comes from history: Users can continue using Cmd+Up/Down to navigate through more history items
  • When user types text: Cmd+Up/Down switches to native cursor movement behavior
  • Smart reset: The system resets when text is populated from history, message is submitted, or input is cleared
goose-chat-input-cursor-ux.mov

Technical Implementation

  • Added hasUserTyped state to track when user actively modifies the input field
  • Updated history navigation logic to only prevent navigation when hasUserTyped && displayValue.trim() !== ''
  • Reset tracking appropriately in handleChange, performSubmit, history navigation, and initialization

Benefits

Preserves all existing functionality - History navigation works exactly as before when input is empty
Allows continued history navigation - Users can navigate through multiple history items without interference
Enables native text editing - When users type, they get familiar macOS cursor movement behavior
Smart and intuitive - Behavior automatically adapts based on how text got into the field
No breaking changes - All existing tests should continue to pass

Testing

  • TypeScript compilation passes
  • ESLint checks pass
  • Existing history navigation functionality preserved
  • Native cursor movement works when user types text
  • Continued history navigation works when text comes from history

Fixes the UX friction mentioned in the team discussion where Cmd+Up would unexpectedly replace user-typed text.

aharvard added 2 commits July 3, 2025 12:16
Resolved conflict in ChatInput.tsx by combining:
- History navigation improvements (hasUserTyped tracking)
- New @ mention functionality for file selection

Both features now work together seamlessly.
@angiejones angiejones merged commit a2081e6 into block:main Jul 7, 2025
6 checks passed
@angiejones
Copy link
Collaborator

thank you!

zanesq added a commit that referenced this pull request Jul 8, 2025
* 'main' of github.com:block/goose:
  feat: Add environment variables to override model context limits (#3260)
  chore(release): release version 1.0.34 (#3285)
  fix(devcontainer): install protoc to fix build (#3267)
  Enabling npx command to install on Windows Desktop (#3283)
  Fix: Allow native Cmd+Up/Down cursor movement when user has typed text (#3246)
  chore(release): release version 1.0.33 (#3284)
  fix Windows Env Vars (#3282)

# Conflicts:
#	ui/desktop/src/components/ChatInput.tsx
dianed-square added a commit to dianed-square/goose that referenced this pull request Jul 8, 2025
* update-to-v1.0.35: (57 commits)
  chore(release): release version 1.0.35 (block#3292)
  docs: enhanced code editing topic (block#3287)
  fix cu (block#3291)
  feat: Add environment variables to override model context limits (block#3260)
  chore(release): release version 1.0.34 (block#3285)
  fix(devcontainer): install protoc to fix build (block#3267)
  Enabling npx command to install on Windows Desktop (block#3283)
  Fix: Allow native Cmd+Up/Down cursor movement when user has typed text (block#3246)
  chore(release): release version 1.0.33 (block#3284)
  fix Windows Env Vars (block#3282)
  feat: bedrock image content support (block#3266)
  Add support in goose configure for streaming http mcp tools (block#3256)
  docs: add Alby MCP tutorial (block#3217)
  refactor(tests): make logging test in goose-cli less flaky on macos (block#3273)
  feat: cli can work with gui generated recipes (block#3254)
  Goose projects docs (block#3272)
  feat: add support for 'cu' command in extension installation (block#3261)
  Docs: Add cloudinary mcp tutorial (block#3268)
  fix: Enable agent to see instruction to use final output tool when it wasn't called (block#3253)
  Use command line to run sub agent and sub recipe (in sequence or parallel) (block#3190)
  ...
lifeizhou-ap added a commit that referenced this pull request Jul 9, 2025
* main: (23 commits)
  docs: VS Code MCP video (#3307)
  docs: fixed broken link (#3306)
  Add YouTube video to Netlify MCP documentation (#3302)
  docs: add sub-recipes topic (#3241)
  docs: move topics to tutorials section (#3297)
  site analytics (#3293)
  chore(release): release version 1.0.35 (#3292)
  docs: enhanced code editing topic (#3287)
  fix cu (#3291)
  feat: Add environment variables to override model context limits (#3260)
  chore(release): release version 1.0.34 (#3285)
  fix(devcontainer): install protoc to fix build (#3267)
  Enabling npx command to install on Windows Desktop (#3283)
  Fix: Allow native Cmd+Up/Down cursor movement when user has typed text (#3246)
  chore(release): release version 1.0.33 (#3284)
  fix Windows Env Vars (#3282)
  feat: bedrock image content support (#3266)
  Add support in goose configure for streaming http mcp tools (#3256)
  docs: add Alby MCP tutorial (#3217)
  refactor(tests): make logging test in goose-cli less flaky on macos (#3273)
  ...
michaelneale added a commit that referenced this pull request Jul 9, 2025
* main: (23 commits)
  docs: VS Code MCP video (#3307)
  docs: fixed broken link (#3306)
  Add YouTube video to Netlify MCP documentation (#3302)
  docs: add sub-recipes topic (#3241)
  docs: move topics to tutorials section (#3297)
  site analytics (#3293)
  chore(release): release version 1.0.35 (#3292)
  docs: enhanced code editing topic (#3287)
  fix cu (#3291)
  feat: Add environment variables to override model context limits (#3260)
  chore(release): release version 1.0.34 (#3285)
  fix(devcontainer): install protoc to fix build (#3267)
  Enabling npx command to install on Windows Desktop (#3283)
  Fix: Allow native Cmd+Up/Down cursor movement when user has typed text (#3246)
  chore(release): release version 1.0.33 (#3284)
  fix Windows Env Vars (#3282)
  feat: bedrock image content support (#3266)
  Add support in goose configure for streaming http mcp tools (#3256)
  docs: add Alby MCP tutorial (#3217)
  refactor(tests): make logging test in goose-cli less flaky on macos (#3273)
  ...
GaryZhous pushed a commit to GaryZhous/goose that referenced this pull request Jul 9, 2025
atarantino pushed a commit to atarantino/goose that referenced this pull request Jul 14, 2025
block#3246)

Signed-off-by: Adam Tarantino <tarantino.adam@gmail.com>
s-soroosh pushed a commit to s-soroosh/goose that referenced this pull request Jul 18, 2025
block#3246)

Signed-off-by: Soroosh <soroosh.sarabadani@gmail.com>
kwsantiago pushed a commit to kwsantiago/goose that referenced this pull request Jul 19, 2025
cbruyndoncx pushed a commit to cbruyndoncx/goose that referenced this pull request Jul 20, 2025
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.

2 participants