fix(xiaohongshu): prioritize visible title input over hidden scaffolding#1845
Open
Benjamin-eecs wants to merge 1 commit into
Open
fix(xiaohongshu): prioritize visible title input over hidden scaffolding#1845Benjamin-eecs wants to merge 1 commit into
Benjamin-eecs wants to merge 1 commit into
Conversation
input[class*="title"] also matches two 4 px wide hidden inputs that have no v-model commit on save; placeholder-based selectors target the real user-facing title input so the draft saves with the typed title. Fixes jackwener#1840
1c0133e to
403d225
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refines Xiaohongshu publish flow title-field detection to avoid targeting hidden/scaffolding inputs by adjusting selector priority and documenting the rationale.
Changes:
- Reordered
TITLE_SELECTORSto prefer placeholder-based<input>selectors before class-based ones. - Expanded inline documentation explaining UI variants and why placeholder selectors must take precedence.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
opencli xiaohongshu publish --title <text>saves the draft with an empty title even though the command reportsstatus: ✅ 暂存成功with the title echoed indetail.opencli xiaohongshu draftsshows the just-saved entry as(untitled), and the rawimage-draftIndexedDB row hascontent.draftStore.title === "". Same symptom as #1840.The cause is selector priority in
TITLE_SELECTORSatclis/xiaohongshu/publish.js:34, not the typing mechanism. On the current creator-center DOM,document.querySelectorAll('input[class*="title"]')matches three visible inputs: two 4 px wide hidden scaffolding inputs (empty placeholder, register a Vue 3 IME composition handler set[onChange, onCompositionstart, onCompositionend, onInput]but never commit on save) plus the real user-facing title input (placeholder="填写标题会有更多赞哦", 499 px wide, simple[onChange, onInput, onFocus, onBlur]handler set, Vue 3 v-model). The previous order listedinput[class*="title"]before the placeholder-based variants, sofillFieldtyped into the first hidden 4 px input, its DOM.valueupdated, the verify phase read the same hidden input back and the command reported a false positive. The real Vue-bound input never received a keystroke, so the draft persisted with an empty title.Move
input[placeholder*="标题"]andinput[placeholder*="title" i]ahead of the class-based variants inTITLE_SELECTORS. The placeholder-based selectors uniquely target the real user-facing title input across the variants currently shipped by xiaohongshu. The class-based selectors stay as fallbacks for any future variant that drops the Chinese placeholder. No typing path, locator helper, or save flow is touched.Related issue: fixes #1840.
Type of Change
Checklist
Screenshots / Output
Live verified on a logged-in
creator.xiaohongshu.comsession with opencli 1.8.2 + Browser Bridge v1.0.17 on macOS 26.5. The verification compares the draftcontent.draftStore.titlewritten to theimage-draftIndexedDB store before and after this patch:draftStore.title(untitled)""(BODY persisted correctly)TITLE_REAL1780481801"TITLE_REAL1780481801"(BODY persisted correctly)DOM probe at
fillFieldresolve time:The class-based selectors return the two 4 px hidden scaffolding inputs first; the placeholder-based selector returns the real visible input. All test drafts created during verification were deleted via
opencli xiaohongshu draft-delete <id> --execute trueafter the run.No code under test outside
clis/xiaohongshu/publish.jswas touched.cli-manifest.jsonis untouched (selectors are static array literals).