Skip to content

Lexical RichText: Adding a row to a second Array block scrolls back to the first Array block #14333

@MarvinVrdoljak

Description

@MarvinVrdoljak

Describe the Bug

When using the Payload Template with a Lexical RichText field that contains an Array-type block, adding a row to a second Array block causes the editor viewport to jump/scroll back to the first Array block instead of keeping focus/scroll position on the newly added row in the second block.

Aufzeichnung.2025-10-23.122017.1.mp4

Link to the code that reproduces this issue

https://github.com/MarvinVrdoljak/payload-bug-report-3/tree/array-viewport-scroll-bug-in-lexical

Reproduction Steps

  1. Open any page/collection that uses a Lexical RichText field (e.g., a Hero (Lexical) block) which allows inserting an Array block.
  2. Insert an Array block into the rich text and add a row.
  3. Add some content (text/blocks) so that the page becomes scrollable—this makes the scrolling issue easier to see.
  4. Below that content, insert another Array block and add a row to this second block.
  5. Observed: as soon as the row is added, the editor scrolls up to the first Array block instead of keeping the viewport at (or scrolling to) the newly created row in the second block.

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.10.0
Relevant Packages:
  payload: 3.61.0
  next: 15.3.0
  @payloadcms/db-mongodb: 3.61.0
  @payloadcms/email-nodemailer: 3.61.0
  @payloadcms/graphql: 3.61.0
  @payloadcms/live-preview: 3.61.0
  @payloadcms/live-preview-react: 3.61.0
  @payloadcms/next/utilities: 3.61.0
  @payloadcms/payload-cloud: 3.61.0
  @payloadcms/plugin-form-builder: 3.61.0
  @payloadcms/plugin-nested-docs: 3.61.0
  @payloadcms/plugin-redirects: 3.61.0
  @payloadcms/plugin-search: 3.61.0
  @payloadcms/plugin-seo: 3.61.0
  @payloadcms/richtext-lexical: 3.61.0
  @payloadcms/translations: 3.61.0
  @payloadcms/ui/shared: 3.61.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 15672
  Available CPU cores: 22

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions