Repository navigation
fix(check): a nested line's words stay out of the line around it - #7705
Open
wonjangcloud9 wants to merge 1 commit into
Open
wonjangcloud9 wants to merge 1 commit into
wonjangcloud9 wants to merge 1 commit into
Conversation
The craft sampler read a block's text with innerText, which takes in every descendant, including block-level children that the sampler reads as lines of their own. A card like `<div>설계자 <div>코드는 코덱스</div></div>` became two lines, "설계자 코드는 코덱스" (3 words) and "코드는 코덱스" (2 words), so the nested words were counted twice and the same text was reported twice by line_unread. A block with a nested reading block now leaves that child's text out of its own; blocks without one keep the innerText reading. The block text is also computed once per block per sample instead of once per text element. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
The craft sampler no longer counts a nested reading block's words a second time in the block around it. The same text is no longer reported twice by
line_unread, once on the parent and once on the child.Why
craftTextParts(packages/cli/src/commands/layout-audit.browser.js) gave every text element theinnerTextof its reading block.innerTextincludes block-level children, whichreadingBlocktreats as lines of their own. An end card liketurned into two lines, and both were reported:
The child's two words were counted in both lines. A mid-film title with a nested subtitle
<div>gets the same double warning and an over-counted floor. This happens on any flex row too: a flex container's children are block-level, so.hd { display:flex }with<div>!</div>EMERGENCY ALERT<div>now</div>was read as "! EMERGENCY ALERT now".Related work
line_unread,last line,craft).innerText.How
readingBlockText(block, root): if any child node is a reading block of its own (readingBlock(child) === child, not counting<br>), the block's text is built from its own text nodes and inline children, and each nested block becomes a separator. Otherwise it returnsinnerTextas before.MapincraftTextParts), where it used to run once per text element. For a line split into one span per glyph, that is one read instead of one per glyph.Test plan
keeps a nested line's words out of the line around it(layout-audit.browser.test.ts) fails onmain(the outer line reads "설계자 코드는 코덱스") and passes with the fix. A second test keeps inline word spans as one line.layout-audit.browser.test.ts: 222 passed.layout-audit.chromium.test.tsrun locally withPUPPETEER_EXECUTABLE_PATHset to chrome-headless-shell: 83 passed.hyperframes check --no-cache --json, card held 1.5 s):main:#p3-pp0"설계자 코드는 코덱스" (3 words) and#p3-pp0 > div:nth-of-type(1)"코드는 코덱스" (2 words).#p3-pp0"설계자" (1 word) and the child "코드는 코덱스" (2 words). No words are counted twice.fallow audit --base origin/main, typecheck (pre-commit).Each chunk of a closing card is still reported as its own "film's last line". I am raising that separately, since it is a reporting-shape question.
🤖 Generated with Claude Code