Skip to content

feat(list): add disableTakeFocusOnClick option to CheckListPlugin (#7689) #7696

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mrbuddhu
Copy link

Summary

Adds a disableTakeFocusOnClick option to the CheckListPlugin, allowing users to disable focusing the editor when a checklist item is clicked. This is especially useful on mobile, where focusing brings up the keyboard unnecessarily.

Fixes #7689

Test Plan

  • Pass disableTakeFocusOnClick={true} to the CheckListPlugin.
  • On mobile, clicking a checklist item toggles it without focusing or opening the keyboard.
  • Default behavior (focus on click) is unchanged for existing users.

…cebook#7689)\n\nAdds an option to disable focusing the editor on checklist item click, which helps avoid unwanted keyboard popups on mobile. Fixes facebook#7689.
Copy link

vercel bot commented Jul 16, 2025

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

Name Status Preview Comments Updated (UTC)
lexical ❌ Failed (Inspect) Jul 21, 2025 7:43pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 7:43pm

@facebook-github-bot
Copy link
Contributor

Hi @mrbuddhu!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@mrbuddhu
Copy link
Author

Signed CLA

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Jul 16, 2025
@ivailop7
Copy link
Collaborator

Not stealing the cursor focus upon clicking a checkbox should be the default behaviour IMO.

Playing with the PR preview, it only works if I tick the checkbox that is on the same line as the caret, but not if I check/uncheck box 1, when the caret is on line 3, it still steals the focus.

Comment on lines +281 to +285

export function registerCheckList(
editor: LexicalEditor,
options?: { disableTakeFocusOnClick?: boolean }
): () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be here

Suggested change
export function registerCheckList(
editor: LexicalEditor,
options?: { disableTakeFocusOnClick?: boolean }
): () => void;

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

I think it would be more useful if it just worked in the expected way, especially on mobile. It's hard to review this without any live environment or tests that demonstrates the usage, it just adds a toggle but you can't turn it on without editing the code and running it locally.

For all I know there could be a separate issue related to focus if there happens to be an existing selection when this node is mutated but I can't quickly verify if that's the case or not.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Add an option to disable focus on click in CheckListPlugin
4 participants