Skip to content

[lexical-react] Fix the context menu event listener element - #7778

Merged
etrepum merged 2 commits into
meta:mainfrom
ivailop7:context_menu_fix
Aug 26, 2025
Merged

etrepum merged 2 commits into
meta:mainfrom
ivailop7:context_menu_fix

Conversation

@ivailop7

Copy link
Copy Markdown
Collaborator

Fix for #7777

@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 Aug 26, 2025
@vercel

vercel Bot commented Aug 26, 2025 •

Copy link
Copy Markdown

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

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Aug 26, 2025 8:38pm
lexical-playground Ready Ready Preview Comment Aug 26, 2025 8:38pm

Comment on lines +251 to +256
const editorElement = editor.getRootElement();
if (editorElement) {
editorElement.addEventListener('contextmenu', onContextMenu);
return () =>
editorElement.removeEventListener('contextmenu', onContextMenu);
}

@etrepum etrepum Aug 26, 2025 •

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 isn't coherent if the root element ever changes for whatever reason, this should use a RootListener one way or another (either outside with state or inside here)

@etrepum
etrepum added this pull request to the merge queue Aug 26, 2025
Merged via the queue into meta:main with commit 7b16879 Aug 26, 2025
@ivailop7
ivailop7 deleted the context_menu_fix branch August 27, 2025 11:45
@etrepum etrepum mentioned this pull request Sep 5, 2025

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — 1f82d2b2 Deployed Aug 26, 2025 by vercel[bot]
Preview – lexical — 1f82d2b2 Deployed Aug 26, 2025 by vercel[bot]
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.

2 participants