Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical][lexical-table] Bug Fix: Allow TableSelection to be preserved during contextmenu events #6964

Merged
merged 5 commits into from
Dec 14, 2024

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Dec 14, 2024

Description

LexicalEvents traps all pointerdown events to update the selection later on pointerup, but it doesn't check for the button so this also updates selection on contextmenu events.

Also refactors a lot of our DOM guards to consistently use functions like isHTMLElement or the new isDOMNode rather than using instanceof (not compatible with frames) or casts (unsafe). These functions now accept unknown rather than a specific type such as EventType or Node for ease of use without any real loss of safety.

Closes #6941

Test plan

Before

playground url

lexical-table-selection-contextmenu-before.mov

After

PR playground url

lexical-table-selection-contextmenu-after.mov

Copy link

vercel bot commented Dec 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 6:07pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 6:07pm

@facebook-github-bot facebook-github-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 Dec 14, 2024
Copy link

github-actions bot commented Dec 14, 2024

size-limit report 📦

Path Size
lexical - cjs 31.2 KB (0%)
lexical - esm 31.04 KB (0%)
@lexical/rich-text - cjs 40.16 KB (0%)
@lexical/rich-text - esm 32.95 KB (0%)
@lexical/plain-text - cjs 38.77 KB (0%)
@lexical/plain-text - esm 30.16 KB (0%)
@lexical/react - cjs 42.05 KB (0%)
@lexical/react - esm 34.24 KB (0%)

@etrepum etrepum added this pull request to the merge queue Dec 14, 2024
Merged via the queue into facebook:main with commit 26c6f26 Dec 14, 2024
40 checks passed
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.

Bug: Table selection disappears when using the custom context menu
3 participants