fix(type): add --enter to commit async-autocomplete/tag widgets#51
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.insertTextnever fires thekeydown/inputevents 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,clickfor the category radios andfillfor title/summary work fine; only this custom widget is unreachable.)See #50 for the full repro.
Fix
Add
type --enter(alias--commit-enter):--key-events— real per-character keystrokes, which do trigger the dropdown (a bulkinsertTextdoesn't, so there'd be nothing for Enter to commit).type @e6 "ChatGPT" --enter) and the--focusedpath.If you'd rather pick from the list explicitly, the existing flow still works:
type --key-events, thensnapshot -iandclickthe candidate.Changes
cli/src/commands.rs— parse--enter/--commit-enter, forcekeyEventson, threadcommitEnterthrough; updated usage string; addedtest_type_commit_enter.cli/src/native/actions.rs— callcommit_with_enterafter typing when set (selector + focused paths); returncommittedin the result.cli/src/native/interaction.rs—commit_with_enterhelper (settle → Enter → settle).skill-data/core/SKILL.md— documenttype --enter.Test
cargo test test_type_commit_enterpasses; 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-eventspath plus a settled Enter.Fixes #50