Repository navigation
fix(record): keep contenteditable line breaks in recorded fill values - #724
Open
shunxinyi-ljs wants to merge 4 commits into
Open
shunxinyi-ljs wants to merge 4 commits into
shunxinyi-ljs wants to merge 4 commits into
Conversation
shunxinyi-ljs
marked this pull request as ready for review
November 13, 2026 05:07
Collaborator
|
Great work! |
Recording read a contenteditable value with `textContent`, which drops the line boundaries Chrome stores as <div> and <br> elements. Typing "Alpha", Enter, "Beta" recorded `value: "AlphaBeta"`, so replay collapsed the edit. Read the editor the way `bsk fill` verifies it: typed layouts are read as literal lines, other rich structures keep their rendered text. Fixes Tencent#594
The helper returned Input.insertText's reply, which does not match the Promise<void> the edit callback declares; tsc rejects it in CI.
shunxinyi-ljs
force-pushed
the
fix/record-editor-line-breaks
branch
from
November 13, 2026 10:15
2de7644 to
e5a6d63
Compare
…ncent#724) Why: 1. Main advanced past 0.5.0 through Wave 2-5A (Tencent#731-Tencent#754) and Tencent#749, creating adjacent [Unreleased] merge conflicts in CHANGELOG.md and CHANGELOG.zh-CN.md. 2. Tencent#731/Tencent#732 unified real-browser suites on BSK_TEST_CHROME and enforced via scripts/run-browser-tests.test.mjs that every *.browser.test.ts suite is registered in .github/workflows/ci.yml with zero skipped assertions. What: - Merge origin/main and place the bilingual Tencent#594/Tencent#724 changelog entries under [Unreleased] -> Fixed / 修复. - Migrate apps/extension/src/content/__tests__/record-editor-value.browser.test.ts from legacy BSK_CLICK_CHROME to BSK_TEST_CHROME. - Register src/content/__tests__/record-editor-value.browser.test.ts in .github/workflows/ci.yml alongside record-input-buttons.browser.test.ts.
This branch has not been deployed
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.
The recorded fill value of a contenteditable editor lost its line breaks: the value was read with
textContent, which does not contain the boundaries Chrome stores as<div>/<br>. TypingAlpha, Enter,Betarecordedvalue: "AlphaBeta", so replaying the trace collapsed the edit into one line. Fixes #594.Change.
fillableValuenow reads an editor the waybsk fillverifies the same value (FILL_VALUE_FUNCTIONintools/interaction.ts): typed layouts are read as literal<div>/<br>lines, other rich structures keep their rendered text, and line-edge whitespace followswhite-space. Inputs and textareas still read.value. This is one function inapps/extension/src/content/record-capture.ts; the fill tool is unchanged. The fill reader is a page-world function string, so it is mirrored rather than imported.Failing evidence. On unmodified
main, in real Chrome 157.0.8103.51 (CDPInput.insertTextplus Enter, productionstartRecordCapture, Windows): the editor's DOM becomesAlpha<div>Beta</div>and the emitted step carriesvalue: "AlphaBeta".Verification.
record-editor-value.browser.test.ts, 6 cases in real Chrome: 6 fail on unmodifiedrecord-capture.ts, 6 pass with the change. One case also asserts the recorded value carries no U+00A0, because Chrome types a space at a line edge as a non-breaking space. Opt-in viaBSK_CLICK_CHROMElike the existing browser tests, so CI does not run it.record-capture.test.ts, happy-dom, runs in CI: 9 cases added. On unmodifiedrecord-capture.ts6 fail; the other 3 (single line, pre-wrap whitespace, empty editor) are guards that pass on both sides. The file passes, 52 cases.record-input-buttons.browser.test.ts: 10 passed.tsc --noEmitandbiome formatclean on the changed files.Behaviour change. Recorded fill values for contenteditable editors now contain
\nat the lines the person typed, and the rendered text for rich structures such as<p>blocks. Existing recordings keep their old values.bsk fillalready accepts multi-line values for editors, so replay and its verification agree again.The whitespace rule mirrors the current
FILL_COLLAPSES_WHITESPACE(normal,nowrap). Chrome also types edge spaces as U+00A0 inpre-lineeditors, which still reach the recorded value; #639 addspre-lineto the fill side, and the recorder should follow once that lands rather than lead it here.