Layout Builder jumps to top when removing section/block

Created on 17 June 2020, over 4 years ago
Updated 11 September 2023, about 1 year ago

Problem/Motivation

Layout builder's interface is always jumping (scrolling) to the top of the page after removing a section or a block.
This is especially annoying when dealing with a page with lots of contents as we need to re-scroll back to where we were each time.

Steps to reproduce:

1. Install default site profile. Theme Oliviero will be configured on Front.
2. Enable module "Layout Builder"
3. On page "Block Layout" /admin/structure/block disable blocks "Search form (narrow)" and "Search form (wide)"
4. Enable Layout Builder for a content type, for example Basic Page "/admin/structure/types/manage/page/display"
5. Go to Layout Builder configuration for a Content type /admin/structure/types/manage/page/display/default/layout
6. Try to add a new Section/Block
7. Remove a Section
8. After submit, the page focuses on a "Save" button which is on top.

The issue is related to Drupal AJAX behavior on success defined in core/misc/ajax.js, see $(target).trigger('focus');.
The AJAX system automatically moves focus to the first tabbable element after closing a dialog, sometimes scrolling to a page top.

Proposed resolution

Disable refocus after a dialog close for Layout Rebuild forms (Remove Section/Block).

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.1 ✨

Component
Layout builderΒ  β†’

Last updated about 19 hours ago

Created by

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024