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

When creating a new check list, set the checked value of the list item to false instead of undefined #5978

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

Conversation

amanharwara
Copy link
Contributor

@amanharwara amanharwara commented Apr 27, 2024

At the moment, when creating a new checklist, the newly created list item doesn't have the checked set until the user manually toggles it. This PR makes sure that the checked value is set to false and not undefined.
This also makes the behavior in line with the behavior when creating a check list using the markdown transformer.

lexical-checklist.mp4

Copy link

vercel bot commented Apr 27, 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 May 12, 2024 5:44pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2024 5:44pm

@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 Apr 27, 2024
Copy link
Contributor

@potatowagon potatowagon left a comment

Choose a reason for hiding this comment

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

do u mind updating the description with recordings/screenshots to show no regressions to checklist behavior please?

const listItem = $createListItemNode();
const listItem = $createListItemNode(
listType === 'check' ? false : undefined,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if its more appropriate to make the handling of this behaviour clearer inside packages/lexical-list/src/LexicalListItemNode.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how about now? i've refactored LexicalListItemNode.getChecked() to always return a boolean if the parent list type is "check" and undefined otherwise.

@potatowagon
Copy link
Contributor

packages/lexical-playground/tests/e2e/List.spec.mjs:1170:3 › Nested List › Can create check list, toggle it to bullet-list and back

is breaking

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.

None yet

3 participants