payloadcms / payloadcms/payload

Editing a content inside a nested rich text blocks sometimes takes the cursor outside of it and start writing content to the parent rich text

Open
#17,468 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

richtext-lexical status: needs-triage v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

We have a rich text block inside another rich text (nested richtext)
Lets say we have a richtext block A and another richtext block B inside A with a BlockFeature, sometimes where we are writing content inside B, it automatically takes the cursor outside of B to the parent richtext A and starts writing content the content in A richtext

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/richtext-lexical/src/features/blocks/server/index.ts

Reproduction Steps

Suppose we have this schema

 {
        name: 'content', // Parent richt text A
        type: 'richText',
        label: 'Content',
        editor: lexicalEditor({
            features: () => [
                HeadingFeature({ enabledHeadingSizes: ['h2'] }),
                ParagraphFeature(),
                LinkFeature(),
                BoldFeature(),
                ItalicFeature(),
                UnderlineFeature(),
                InlineToolbarFeature(),
                OrderedListFeature(),
                UnorderedListFeature(),
                BlocksFeature({
                    blocks: [
                        {
                            slug:'nested-content',
                            fields: [
                                {
                                    name:'content',
                                    type:'richText' // Nested richtext B
                                }
                            ]
                        }
                    ],
                }),
            ],
        }),
    },

In the editor, when we start writing content in nested-content B, the cursor automatically goes outside B and starts writing content in A the parent richtext block

Which area(s) are affected?

plugin: richtext-lexical

Environment Info
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 11.9.0
Relevant Packages:
  payload: 3.84.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.5.0: Tue Jun  9 22:27:52 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T8112
  Available memory (MB): 24576
  Available CPU cores: 8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/richtext-lexical/src/features/blocks/server/index.ts and reproduce the nested-content schema described in the issue. Trace what happens when typing inside nested rich text B; done means the cursor remains in B and new content is not inserted into parent rich text A.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.