Focus always on top when adding/removing items in blocks using Layout Builder

Created on 19 September 2024, 2 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

Using Layout Builder, the cursor always jumps to the top when adding/removing items in blocks.

The cursor automatically moves to the title field at the top of the page, which disrupts the editing experience.

Steps to reproduce

1. Install and enable the Layout Builder and Paragraphs modules.
2. Ensure your site is running on Drupal 10.2.6.
3. Enable Layout Builder for a specific content type (e.g., "Landing Page").
4. Create two custom block types:
Block Type 1: Contains a Paragraph reference field (for multiple paragraph items).
Block Type 2: Contains an image field (for single or multiple image uploads).
5. Create a node of the content type enabled with Layout Builder.
6. Go to the Layout tab for that node and click on "Add Block."
7. In the right-hand panel, click on "Create Content Block" and select Block Type 1.
8. Fill in the fields, add multiple Paragraph items, and notice the issue:

After filling the fields and clicking "Add another item" in the Paragraph section, the page jumps to the top, and the cursor focuses on the title field.

9. Repeat the same steps for Block Type 2 (with an image field):

After selecting or uploading an image, the cursor again moves to the title at the top of the page.

Proposed resolution

The cursor should remain in the active field area without resetting to the top of the page when adding/removing content (e.g., adding paragraph items or selecting images).

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs review

Version

11.0 🔥

Component
Layout builder 

Last updated about 13 hours ago

Created by

🇮🇳India arunkumark Coimbatore

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024