fix(text-editor): style selection stuck to paragraph on empty line#7706
Open
mihai-albu-sage wants to merge 1 commit intomasterfrom
Open
fix(text-editor): style selection stuck to paragraph on empty line#7706mihai-albu-sage wants to merge 1 commit intomasterfrom
mihai-albu-sage wants to merge 1 commit intomasterfrom
Conversation
fad67d4 to
a61569e
Compare
a61569e to
40c4978
Compare
9c77568 to
6c9943c
Compare
nicktitchmarsh
previously approved these changes
Jan 16, 2026
edleeks87
reviewed
Jan 23, 2026
Contributor
edleeks87
left a comment
There was a problem hiding this comment.
Proposed code changes are fine, I think it might be worth adding some form of testing for this so we can catch if it regresses
2d37e98 to
db75b4d
Compare
Contributor
Author
added corresponding playwright test |
edleeks87
previously approved these changes
Jan 26, 2026
nicktitchmarsh
previously approved these changes
Jan 27, 2026
f2cf469
db75b4d to
f2cf469
Compare
2298fb9 to
003a67e
Compare
003a67e to
5585495
Compare
edleeks87
approved these changes
Feb 5, 2026
nicktitchmarsh
approved these changes
Feb 6, 2026
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.
Proposed behaviour
This PR addresses an issue where users can not pre-select typography styles on an empty line. By introducing a "zero-width space" placeholder, we allow the editor to maintain state and focus for a new node before text input begins.
Changing the typography dropdown on an empty row now explicitly creates a
TextNodeorStyledSpanNodematching the selected style. To ensure the browser maintains cursor focus within this new node, the content is initialized with a zero-width space character (\u200B).This enables "type-over" styling, allowing users to set their desired typography before they start typing on a new line.
after.mp4
Current behaviour
Pressing
Entercreates an empty paragraph row without an underlyingTextNodeorStyledSpanNode. TheuseEffectmanaging the typography dropdown defaults to "Paragraph" for empty rows.If a user attempts to change the typography on an empty row, the editor reverts the selection to "Paragraph" because there is no node to apply the style to. Styling currently only triggers if the row already contains text.
before.mp4
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions