facebook / facebook/lexical

Bug: Triple-click does not select all text in a node if followed by a DecoratorBlockNode

Open
#7,618 4 comments 0 reactions 0 assignees View on GitHub
decorators selection
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

When triple-clicking within a text node, Lexical normally selects all the text in that node as expected. However, if the text node is immediately followed by a DecoratorBlockNode, triple-clicking instead results in a collapsed selection at the start of the node, rather than selecting the entire contents.

This behavior does not occur when the DecoratorBlockNode is not immediately after the text node.

**Video showing this in action**

https://github.com/user-attachments/assets/f55439c5-6b36-4732-9df3-1fcc4530167c

Lexical version: 0.32.1

## Steps To Reproduce
1. Open the [Lexical Playground](https://playground.lexical.dev/) and create a text node with some content.
3. Insert a DecoratorBlockNode directly after it, e.g. by adding a YouTube video (here I added https://www.youtube.com/watch?v=_maPaQy9jWY).
4. Triple-click anywhere within the text node.
5. Observe the selection behavior and notice how the cursor moves to the start of the line.

## The current behavior

The selection collapses to the start of the text node.

## The expected behavior

All text within the node should be selected.

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.