Skip to content

Fix duplicated character input in press_key#421

Open
monir600p-blip wants to merge 1 commit into
browser-use:mainfrom
monir600p-blip:codex/fix-duplicated-character-input
Open

Fix duplicated character input in press_key#421
monir600p-blip wants to merge 1 commit into
browser-use:mainfrom
monir600p-blip:codex/fix-duplicated-character-input

Conversation

@monir600p-blip

@monir600p-blip monir600p-blip commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Fix duplicated text entry for printable single-character keys in press_key().

Problem

press_key() was sending printable characters twice:

  • once via Input.dispatchKeyEvent with type="keyDown" and text=...
  • again via Input.dispatchKeyEvent with type="char"

That caused helpers like fill_input(...) to duplicate every typed character.

Fix

Only send text on keyDown for non-single-character cases.
Printable single-character input is now inserted by the char event only.

Verification

Verified locally with browser-harness against a real Chrome session:

  • fill_input(...) now writes normal text without duplication
  • form fields on https://httpbin.org/forms/post were filled correctly
  • navigation and page-reading behavior still worked afterward

Summary by cubic

Fix duplicated character input in press_key() by sending printable single-character input via the char event only. Prevents double characters in helpers like fill_input(...) and normal form entry.

  • Bug Fixes
    • Skip text on keyDown for single printable keys; keep char event for insertion. Multi-character cases still send text on keyDown.
    • Verified with browser-harness in Chrome: inputs no longer duplicate; navigation and page reading remain unaffected.

Written for commit ecd1037. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

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