Repository navigation
fix(muya): stop the quick-insert hint claiming a line of its own - #5283
Merged
Merged
Conversation
A paragraph ending in a soft line break rendered one blank line too many until something was typed on the new line, so the content below it jumped down and back again. The quick-insert hint takes `content: attr(placeholder)` from a selector that never required the attribute, and `placeholder` is only set while the quick-insert menu is open. The rest of the time the declaration resolved to an empty string — but the `::after` box was still generated, and an empty box still takes part in layout. A block ending in a soft line break ends with the block-level `mu-line-end` span, which an inline box cannot share a line with, so the hint claimed a line of its own. Match on the attribute so no box exists unless there is a hint to show. The `empty-hint` rule beside it is untouched. Fixes #5282 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01QzDANHQnQyWY3pMWQVR4yB
Nothing in the suite looked at layout, so an `::after` box quietly taking a line went unnoticed. The heights are compared against each other rather than against pixel constants — what the bug did was add a line, and only the ratio between the states says whether it is back. A second case pins both quick-insert hints, since the fix narrows the selector one of them comes from. Verified to fail with the selector widened again (76.8px where 51.2px is correct, exactly one line) while the hint case kept passing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01QzDANHQnQyWY3pMWQVR4yB
1 task done
The hint only renders on a paragraph carrying `mu-active`, which a headless run does not reliably give it — CI read the zero-width space from `.mu-content:empty::after` instead and the case failed there while passing locally. Set the rule's preconditions directly and toggle the `placeholder` attribute, which is the contract the fix actually narrowed: a box when the attribute is there, none when it is not. Verified to fail with the declaration neutered. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01QzDANHQnQyWY3pMWQVR4yB
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.
Fixes #5282
A paragraph ending in a soft line break rendered one blank line too many until something was typed on the new line: press Shift+Enter and everything below jumps down a line, type one character and it jumps back.
Root cause
Not the
mu-line-endspan, which was my first guess and wrong. The same markup measured in the same page:class="mu-content"class="mu-content mu-paragraph-content"mu-paragraph-contentappears in exactly one place in the stylesheet — the quick-insert hint:placeholderis only set while the quick-insert menu is open (ui/paragraphQuickInsertMenu/index.ts:80, removed again at:82). The rest of the time the declaration resolves to an empty string — but the::afterbox is still generated, and an empty box still takes part in layout (measured:::after content="").A block ending in a soft line break ends with the block-level
mu-line-endspan, and an inline box cannot share a line with it, so the hint claimed a line of its own. Disabling that one pseudo-element takes the paragraph from 77px to 51px with the caret geometry untouched.That also explains the red herring: emptying the
\n, or making the span inline, both "fix" the height — they remove the block the::aftercannot sit beside. Symptom relief, not the cause.The fix
No box unless there is a hint to show. The
:empty::afterrule beside it, which renders the "Type / to insert…" hint fromempty-hint, is untouched.Measured
top=93 h=26top=93 h=26(unchanged)第一行\na第一行\na/No DOM change, no change to the DOM ↔ text offset mapping.
Tests
Nothing in the suite looked at layout, so an
::afterbox quietly taking a line went unnoticed. The new spec compares heights against each other rather than against pixel constants — the bug added a line, and only the ratio between the states says whether it is back — and pins both quick-insert hints, since the fix narrows the selector one of them comes from. Verified to fail with the selector widened again (76.8px where 51.2px is correct) while the hint case kept passing.Unit suite 216 files / 1475 tests,
tsc --noEmit,eslint src test(0 errors),stylelint(no new problems — the one error is pre-existing atblockSyntax.css:940). Theime.spec.tstable-cell case that fails locally fails identically on unmodifieddevelop.🤖 Generated with Claude Code
https://claude.ai/code/session_01QzDANHQnQyWY3pMWQVR4yB