Skip to content

[lexical-react] Annotate @deprecated to menuRenderFn with NodeContext…#8001

Merged
thatmichael85 merged 7 commits intomainfrom
users/thatmichael85/annotate-deprecate-menurenderfn
Feb 10, 2026
Merged

[lexical-react] Annotate @deprecated to menuRenderFn with NodeContext…#8001
thatmichael85 merged 7 commits intomainfrom
users/thatmichael85/annotate-deprecate-menurenderfn

Conversation

@thatmichael85
Copy link
Copy Markdown
Contributor

@thatmichael85 thatmichael85 commented Nov 21, 2025

What

Annotate menuRenderFn with @deprecated and point to the link in the playground after #7997

Why

To alert users that this prop is deprecated and to migrate to LexicalNodeContextMenu apis.

The annotation at packages/lexical-react/flow/LexicalContextMenuPlugin.js.flow isn't too helpful

e.g
image

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 10, 2026 8:43pm
lexical-playground Ready Ready Preview, Comment Feb 10, 2026 8:43pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds @deprecated annotations to the menuRenderFn property across multiple Lexical React plugins to guide users toward migrating to the newer LexicalNodeContextMenuPlugin API. The annotations include a link to an example implementation in the playground.

  • Deprecation warnings added to menuRenderFn properties in TypeScript source files
  • Corresponding deprecation warnings added to Flow type definition files
  • Enhanced deprecation documentation for the LexicalContextMenuPlugin component itself

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/lexical-react/src/LexicalTypeaheadMenuPlugin.tsx Added deprecation JSDoc to menuRenderFn property
packages/lexical-react/src/LexicalNodeMenuPlugin.tsx Added deprecation JSDoc to menuRenderFn property
packages/lexical-react/src/LexicalContextMenuPlugin.tsx Added deprecation JSDoc to menuRenderFn property and enhanced function-level deprecation notice
packages/lexical-react/src/LexicalAutoEmbedPlugin.tsx Added deprecation JSDoc to menuRenderFn property
packages/lexical-react/flow/LexicalTypeaheadMenuPlugin.js.flow Added deprecation JSDoc to Flow type definition
packages/lexical-react/flow/LexicalNodeMenuPlugin.js.flow Added deprecation JSDoc to Flow type definition
packages/lexical-react/flow/LexicalAutoEmbedPlugin.js.flow Added deprecation JSDoc to Flow type definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* @deprecated Use LexicalNodeContextMenuPlugin instead. Here is an example for using NodeContextMenuPlugin:
* https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/ContextMenuPlugin/index.tsx
*/
menuRenderFn: ContextMenuRenderFn<TOption>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Besides marking it as deprecated, is it possible to restore the new API that @ivailop7 introduced so that we only get to this as a workaround for surfaces that are time-consuming to migrate? I see there's still a few playground callsites that are using this property already.

Copy link
Copy Markdown
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

A lot of incorrect deprecation comments in this PR.
Putting this here to clarify:
LexicalNodeContextMenu is a replacement ONLY for LexicalContextMenu. The Playground example has been using the new one for 5-6 months+. So the LexicalContextMenu should be fully deletable in its current state.

No other deprecation of menuRenderFn in AutoEmbed, NodeMenu or Typeahead is happening, since they need to have their interface changed, to use the one I did in the now reverted PR, but maybe keep menuRenderFn alongside it for now, as an escape hatch.

dismissFn: () => void,
) => Array<AutoEmbedOption>,
/**
* @deprecated Use NodeContextMenuPlugin instead. Here is an example for using NodeContextMenuPlugin:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is not correct. NodeContextMenuPlugin is not a replacement for AutoEmbedPlugin

onClose?: () => void,
onOpen?: (resolution: MenuResolution) => void,
/**
* @deprecated Use NodeContextMenuPlugin instead. Here is an example for using NodeContextMenuPlugin:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is also not correct. NodeContextMenuPlugin is a replacement only for ContextMenuPlugin, nothing else.

matchingString: string,
) => void,
options: Array<TOption>,
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove this one as well please.

embedFn: () => void,
dismissFn: () => void,
) => Array<AutoEmbedOption>;
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Incorrect as well.

nodeKey: NodeKey | null;
onClose?: () => void;
onOpen?: (resolution: MenuResolution) => void;
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not true

matchingString: string,
) => void;
options: Array<TOption>;
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove this as well.

thatmichael85 and others added 6 commits February 10, 2026 11:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ed, NodeMenu, and TypeaheadMenu plugins

NodeContextMenuPlugin is a replacement only for LexicalContextMenuPlugin,
not for these other plugins. The deprecation annotations on menuRenderFn
in these files were added incorrectly.
@thatmichael85 thatmichael85 added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit d5716cb Feb 10, 2026
39 checks passed
@etrepum etrepum mentioned this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants