Skip to content

fix(type): add --enter to commit async-autocomplete/tag widgets#51

Merged
leeguooooo merged 1 commit into
mainfrom
fix/type-enter-autocomplete-50
Jun 24, 2026
Merged

fix(type): add --enter to commit async-autocomplete/tag widgets#51
leeguooooo merged 1 commit into
mainfrom
fix/type-enter-autocomplete-50

Conversation

@leeguooooo

Copy link
Copy Markdown
Owner

Problem

When automating juejin.cn's article-publish modal, the 「添加标签」(add-tag) input can't be driven. It's a framework-controlled autocomplete: a bulk Input.insertText never fires the keydown/input events the widget queries its suggestion dropdown off, so no candidate ever appears and no tag can be added — and juejin requires ≥1 tag, so publish is blocked. (In the same modal, click for the category radios and fill for title/summary work fine; only this custom widget is unreachable.)

See #50 for the full repro.

Fix

Add type --enter (alias --commit-enter):

  • It implies --key-events — real per-character keystrokes, which do trigger the dropdown (a bulk insertText doesn't, so there'd be nothing for Enter to commit).
  • After typing, it waits for the page to settle (RAF + microtask) so the candidate is mounted/highlighted, then presses Enter once, which these widgets read as "accept the current candidate".
  • Works on both the selector path (type @e6 "ChatGPT" --enter) and the --focused path.
chrome-use type @e6 "ChatGPT" --enter   # types real keystrokes, then commits the candidate

If you'd rather pick from the list explicitly, the existing flow still works: type --key-events, then snapshot -i and click the candidate.

Changes

  • cli/src/commands.rs — parse --enter/--commit-enter, force keyEvents on, thread commitEnter through; updated usage string; added test_type_commit_enter.
  • cli/src/native/actions.rs — call commit_with_enter after typing when set (selector + focused paths); return committed in the result.
  • cli/src/native/interaction.rscommit_with_enter helper (settle → Enter → settle).
  • skill-data/core/SKILL.md — document type --enter.

Test

cargo test test_type_commit_enter passes; full crate compiles.

Caveat: unit-tested the parser wiring; the Enter-commit event path was not live-tested against juejin from CI (no browser there). The event sequence mirrors the existing --key-events path plus a settled Enter.

Fixes #50

juejin.cn's 「添加标签」 input is a framework-controlled autocomplete: a bulk
Input.insertText never fires the keydown/input it queries its suggestion
dropdown off, so no candidate appears and the tag can't be added.

Add `type --enter` (alias --commit-enter): it implies --key-events (real
per-character keystrokes, which do trigger the dropdown) and then presses
Enter once the page has settled, committing the highlighted candidate. Works
on both the selector and --focused paths. Adds a parser unit test.

Fixes #50
@leeguooooo leeguooooo merged commit 1b9b242 into main Jun 24, 2026
6 checks passed
@leeguooooo leeguooooo deleted the fix/type-enter-autocomplete-50 branch June 24, 2026 09:37
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.

juejin.cn 发布弹窗:标签输入框无法用 type/click 触发候选下拉,标签加不进去

1 participant