Skip to content

Commit 3f23160

Browse files
authored
fix(richtext-lexical): unchecked list items were rendered as checked in html converter (#11747)
Previously, unchecked list items had the `checked="false"` attribute, which is not valid in HTML and renders them as checked. This PR omits the `checked` attribute if the list item is unchecked, which is the correct behavior.
1 parent aa3737c commit 3f23160

File tree

2 files changed

+2
-2
lines changed
  • packages/richtext-lexical/src/features/converters/lexicalToHtml

2 files changed

+2
-2
lines changed

packages/richtext-lexical/src/features/converters/lexicalToHtml/async/converters/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ListHTMLConverterAsync: HTMLConvertersAsync<
3737
${
3838
hasSubLists
3939
? children
40-
: `<input checked="${node.checked}" id="${uuid}" readOnly="true" type="checkbox" />
40+
: `<input${node.checked ? ' checked' : ''} id="${uuid}" readOnly="true" type="checkbox" />
4141
<label htmlFor="${uuid}">${children}</label>
4242
<br />`
4343
}

packages/richtext-lexical/src/features/converters/lexicalToHtml/sync/converters/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const ListHTMLConverter: HTMLConverters<SerializedListItemNode | Serializ
3131
${
3232
hasSubLists
3333
? children
34-
: `<input checked="${node.checked}" id="${uuid}" readOnly="true" type="checkbox" />
34+
: `<input${node.checked ? ' checked' : ''} id="${uuid}" readOnly="true" type="checkbox" />
3535
<label htmlFor="${uuid}">${children}</label>
3636
<br />`
3737
}

0 commit comments

Comments
 (0)