facebook / facebook/lexical

Bug: Text direction bug when paragraph starts with a marknode

Open
#7,021 0 comments 0 reactions 0 assignees View on GitHub
marks text direction
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

The text direction (ltr vs rtl) of a paragraph is usually determined by the first letter of the paragraph. However if the first part of the paragraph including the first letter is wrapped in a marknode for commenting, the text direction is set without considering the text inside the marknode.

Lexical version:

## Steps To Reproduce

1. Add an English word in an empty Lexical playground.
2. Add some letters from rtl language. The direction doesn't change.
3. Now wrap the English word in marknode by selecting it and adding a comment on it. The text direction is changed from ltr to rtl.

## The expected behavior
The text direction should not be changed when the starting text is wrapped in a marknode.

![ltr-rtl](https://github.com/user-attachments/assets/29ea5563-2153-4660-80e9-d148f45f40e5)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.