Do not remove the layout-builder-block css class

Created on 15 September 2023, over 1 year ago
Updated 10 February 2024, 10 months ago

Problem/Motivation

LayoutBuilderLock::preRender() removes both layout-builder-block and js-layout-builder-block classes if moving is not allowed. According to the comments, this is "so we can reset the pointer and padding".

This is problematic for front-end themes modifying the element. Depending on how the theme wishes to style blocks, it may mean a lot of doubled css rules to style for both layout-builder-block and layout-builder-block-locked, because there will only ever be one of them, not both. That's inevitably more fragile.

Proposed resolution

Add the layout-builder-block-locked class, remove only the js-layout-builder-block class, and leave the layout-builder-block class in place. A slightly more specific rule can be used to reset the pointer and padding, ie:

.layout-builder-block-locked:not(b) {
  cursor: default;
  padding: 1.5em;
}
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand john pitcairn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024