facebook / facebook/lexical

Bug: The link button is inactive in the toolbar when the entire element is selected

Open
#9,137 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

Lexical version: 0.50.0

## Steps To Reproduce

1. Select all text in a paragraph as a link
2. Press Ctrl + A

[Link to code example](https://playground.lexical.dev/#doc=H4sIAAAAAAAAE51RQU7DMBD8CpqzlaZF0OAHcOKAlCPiYOIlsdja0WYTWlX9O3JKKeXAoSd7dr0zs-M9yAdNUqtTgt1DUtJ8Nl1gLxRhX_4DntQFhi0N3pNsnM7XTfIEi5grDINBd5wLMFDaKiyeaBsaxzef9DYEpdzY9fnJ3DeYSIaQIuzy8Grgg1CjM44j81krM4boKR51vzk4xI8LDgMhPs2qk5b0BwXN1o5gFIZFp9oPdrHgo8fC07TAFTZ6J64V13d_vOQVH89hZVifArpCZv6xi8QOBuwGrd1EHna5rqqqWt3fluvVg8GQRmny3DO7XStpjP73NMririxKHL4AjesC8xoCAAA)

## The current behavior

The link button in the toolbar is inactive, a floating text toolbar is displayed

Image

## The expected behavior

The link button should be active and the link menu should be shown if the `anchor` and `focus` from selection are set to an element with a LinkNode or any other element that contains only LinkNode inside. The same as if only a part of the text were selected, not the entire element

Image

## Impact of fix

The floating toolbar and the static toolbar at the top should show the active state of the buttons, taking into account the selection of entire elements, and not just the text, otherwise it misleads the user

Contributor guide

Open the contributing guide

Research direction

Start with the floating and static toolbar logic for link state, using the linked Lexical Playground reproduction. Trace how the selection's anchor and focus are checked for a LinkNode or an element containing only LinkNode. Done means both toolbars activate the link button and show the link menu when the entire element is selected, as they do for partial text selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.