Required Lexical field accepts two empty paragraphs
Maintainers usually reply within 1 day
@lazerg is already working on this.
Since Oct 30, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
Research direction
Start with packages/richtext-lexical/src/validate/hasText.ts and the required check in packages/richtext-lexical/src/validate/index.ts; inspect tests for hasText and required rich text validation. Check how empty paragraphs are detected while preserving content without text, such as uploads and blocks. Done when multiple empty paragraphs fail required validation and those other content types still pass.
Written by the indexing model from the issue text.
Description
Describe the Bug
A richText field with required: true and the default lexicalEditor() accepts an editor state that holds only two empty paragraphs. One Enter in an empty editor creates that state, so a user can save a required field with no content.
hasText treats the state as empty only when the root has no children, or when it has exactly one paragraph with no children or one empty text node. With two empty paragraphs the single-paragraph check does not apply, and hasText returns true. The required check relies on hasText.
#6435 fixed a similar case, content that was removed by hand. The case with several empty paragraphs remains. It behaves the same in 3.91.0, 3.92.1, 4.0.0-beta.0 to beta.6 and on main (09dab7ea).
Expected: a state that holds only empty paragraphs fails required, as one empty paragraph does today. Content without text, such as an upload or a block, should still pass.
Link to the code that reproduces this issue
https://github.com/woerndl/payload-lexical-required-empty-paragraphs
Reproduction Steps
- Clone the reproduction, copy
.env.exampleto.envand setDATABASE_URLandPAYLOAD_SECRET. pnpm install,pnpm generate:importmap,pnpm dev.- Create the first user, open Posts and click Create New.
- Click Save without touching Body. The save fails: "This field is required."
- Click into Body, press Enter once, click Save. The post is created.
The stored value:
{
"root": {
"type": "root",
"children": [
{ "type": "paragraph", "children": [], "direction": null, "format": "", "indent": 0, "textFormat": 0, "textStyle": "", "version": 1 },
{ "type": "paragraph", "children": [], "direction": null, "format": "", "indent": 0, "textFormat": 0, "textStyle": "", "version": 1 }
],
"direction": null, "format": "", "indent": 0, "version": 1
}
}
The Local API shows the same (pnpm payload run src/repro.ts):
one empty paragraph: rejected (The following field is invalid: Body)
two empty paragraphs: saved <id>
Which area(s) are affected?
plugin: richtext-lexical
Environment Info
Binaries:
Node: 22.23.4
pnpm: 10.34.7
Relevant Packages:
payload: 3.91.0
next: 16.3.3
@payloadcms/db-mongodb: 3.91.0
@payloadcms/richtext-lexical: 3.91.0
@payloadcms/ui/shared: 3.91.0
react: 19.2.6
Operating System:
Platform: darwin
Arch: arm64
Reproduced in the admin and through the Local API on 3.91.0. For the other versions above, the hasText function from each published package was run on the same states.
- Dominant language
- TypeScript
- Stars
- 45.5k
- Forks
- 4.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 302
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
area: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
payloadcms/payload#19198 ·
Maintainers usually reply within 1 day
-
Grid view: show the file placeholder when a thumbnail image fails to loadPossibly taken @lazerg claimed this 2 days ago. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
payloadcms/payload#19181 ·
Maintainers usually reply within 1 day
-
WhereBuilder throws "Cannot read properties of undefined (reading 'value')" when the list URL filters on a field that is not filterablePossibly taken A pull request linked to this issue is open or already merged. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#19002 · 1 comment ·
Maintainers usually reply within 1 day
-
Regression: `findByID` with `disableErrors: true` throws `NotFound` for null/empty ids since 3.91.0Possibly taken @Krrishkumar125 claimed this 10 days ago. Openarea: core Bug invalid-reproduction status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18935 · 2 comments ·
Maintainers usually reply within 1 day
-
bug: Local API call with req resets req.fallbackLocale to defaultLocalePossibly taken A pull request linked to this issue is open or already merged. Openarea: core Bug created-by: Contributor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#18768 ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Slaymish/HealthAgent#7 ·
-
area: engine topic: math type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Get-Concord-AI/concord-mcp#310 ·
Maintainers usually reply within 1 day
-
Correct install_claude: 'marketplace add' over a different source is refused, not replaced in placeOpentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
nightgauge/nightgauge#2804 ·
Maintainers usually reply within 1 day