Skip to content

feat: add focus event option for the checklist extension#8105

Open
rayterion wants to merge 13 commits intofacebook:mainfrom
rayterion:feat/checklist-focus-option
Open

feat: add focus event option for the checklist extension#8105
rayterion wants to merge 13 commits intofacebook:mainfrom
rayterion:feat/checklist-focus-option

Conversation

@rayterion
Copy link

@rayterion rayterion commented Jan 31, 2026

Description

This PR adds an optional configuration parameter, disableTakeFocusOnClick, to CheckListExtension. This allows users to enable or disable editor focus when clicking on checklist items, as described in the related issue:

The changes are implemented in a way that does not break existing usages of CheckListExtension or the CheckListPlugin React component. The new parameter is optional and defaults to the current behavior.

Note: In the file LexicalCheckListPlugin.js.flow, I added what I believe is the correct change based on patterns observed in similar files. However, I did not deeply verify the purpose of all files in that directory, so this part should be reviewed.

Test plan

I tested the behavior by running pnpm run start and verifying how checklist items behave when clicked, both with and without the disableTakeFocusOnClick option enabled.
Steps:

  1. Open packages/lexical-playground/src/appSettings.ts and set shouldDisableFocusOnClickChecklist to either false or true (default is false)
  2. run pnpm run start
  3. create a checklist in the editor (shortcut Ctrl+Shift+9 on pc).
  4. Verify the focus behavior

I have not yet explicitly tested whether the mobile keyboard correctly dismisses when the option is set to true. However, in theory, this should work as expected, since the keyboard should only appear when the editor receives focus.

Additional Context

I noticed there is an existing open PR with the same goal as this one, but it was not completed by its author. For reference:

@vercel
Copy link

vercel bot commented Jan 31, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 18, 2026 9:01pm
lexical-playground Ready Ready Preview, Comment Feb 18, 2026 9:01pm

Request Review

@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 Jan 31, 2026
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.

It would be good to add some tests for this feature, right now there's nothing that demonstrates that it works

@etrepum
Copy link
Collaborator

etrepum commented Feb 4, 2026

This feature still doesn't have any tests, when you add some I will take another look

@rayterion
Copy link
Author

This feature still doesn't have any tests, when you add some I will take another look

I've added the test file. I took a little longer because i was trying to understand the standards for testing in Lexical, but i think i got it right.

@rayterion rayterion requested a review from etrepum February 6, 2026 03:35
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Feb 6, 2026
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.

In this case since we're dealing with focus, etc. and you're using mocks to change the environment's behavior it seems like a better approach would be to write an e2e test for this feature that uses a real browser. Mocking here makes it seem like maybe the tests aren't really doing anything meaningful.

@etrepum
Copy link
Collaborator

etrepum commented Feb 13, 2026

Looks like maybe there's an issue with firefox here since those e2e tests are failing

@rayterion
Copy link
Author

rayterion commented Feb 13, 2026

Looks like maybe there's an issue with firefox here since those e2e tests are failing

I'll probably start fixing it monday.

Once i finish fixing it, should i mention you somehow or maybe requesting a review...?

@etrepum
Copy link
Collaborator

etrepum commented Feb 14, 2026

I should get a notification when new commits are pushed

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.

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

3 participants

Comments