Skip to content

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

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

[lexical-react] Fix the context menu event listener element#7778
etrepum merged 2 commits intofacebook: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
Copy link
Copy Markdown

vercel bot commented Aug 26, 2025

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);
}
Copy link
Copy Markdown
Collaborator

@etrepum etrepum Aug 26, 2025

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 facebook:main with commit 7b16879 Aug 26, 2025
64 of 67 checks passed
@ivailop7 ivailop7 deleted the context_menu_fix branch August 27, 2025 11:45
@etrepum etrepum mentioned this pull request Sep 5, 2025
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