Skip to content

fix(md): update floatWith handlers in link menu to match mentions menu#920

Merged
sedson merged 3 commits intomainfrom
seamus/fix-link-menu-float-position
Jan 12, 2026
Merged

fix(md): update floatWith handlers in link menu to match mentions menu#920
sedson merged 3 commits intomainfrom
seamus/fix-link-menu-float-position

Conversation

@sedson
Copy link
Copy Markdown
Contributor

@sedson sedson commented Jan 12, 2026

Summary

Screenshots, GIFs, and Videos

@sedson sedson requested a review from a team as a code owner January 12, 2026 17:18
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 12, 2026

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Jan 12, 2026

Code review

Found 1 issue:

Bug: Both positioning directives can be active simultaneously

File: js/app/packages/core/component/LexicalMarkdown/component/menu/FloatingLinkMenu.tsx (line 344)

When clicking on an existing link, the handleClick function sets both linkRef and selection on the ILinkInfo object. This means both floatWithElementProps() and floatWithSelectionProps() will return valid options objects, causing both directives to execute simultaneously.

This leads to:

  1. Position style conflicts: floatWithElement sets position: absolute while floatWithSelection sets position: fixed
  2. Multiple autoUpdate listeners that will compete
  3. Potential flickering or incorrect positioning

The MentionsMenu pattern correctly handles this by using mutual exclusion with !props.anchor in the selection props condition.

Suggested fix: Change line 344 from:

    linkInfo()?.selection

to:

    linkInfo()?.selection && !linkInfo()?.linkRef

This ensures only one directive is active at a time, matching the MentionsMenu pattern.

floatingEl: HTMLElement,
accessor: Accessor<FloatWithSelectionOptions | undefined>
) {
console.log('FLOAT WITH SELECTION', accessor()?.selection);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console logs

@sedson sedson merged commit ca0f5f3 into main Jan 12, 2026
21 checks passed
@sedson sedson deleted the seamus/fix-link-menu-float-position branch January 12, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants