Custom blocks break layout builder module - Quick Edit could not associate the rendered entity field markup

Created on 2 August 2019, over 5 years ago
Updated 18 February 2023, over 1 year ago

Steps to reproduce:

-Create a custom block: /admin/structure/block/block-content
-Enable layout builder to some content type.
- Add the custom block via the layout builder:
Go to Manage display -> Manage layout:
Add block -> the custom block-> Save layout
- Edit again via layout builder -> check console errors

Uncaught Error: Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="block_content/1/body/en/full"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="block_content/1"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.

Checked:
https://www.drupal.org/project/drupal/issues/2948828

Edit--

Documentation:
Every field that has 'data-quickedit-field-id', it looks for the attribute 'data-quickedit-entity-id'.
I think we are missing 'data-quickedit-entity-id="block_content/x" ' attribute for custom blocks inside the layout builder.

4 different scenarios:

1. A block that inside the layout builder:

<div data-layout-content-preview-placeholder-label="&quot;block created from the layout builder&quot; block" class="block block-layout-builder block-inline-blockbasic">
      <h2>block created from the layout builder</h2>
      <div class="content">
            <div data-quickedit-field-id="block_content/2/body/en/full" class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>block created from the layout builder</p></div>

2. Other entites that inside the layout builder. entity refernce for example:

<article data-history-node-id="1" data-quickedit-entity-id="node/1" role="article" about="/node/1" typeof="schema:Article" class="node node--type-article node--promoted node--view-mode-default clearfix" data-quickedit-entity-instance-id="1">
  <header>
    
            <h2 class="node__title">
        <a href="/node/1" rel="bookmark" tabindex="-1">
<span property="schema:name" data-quickedit-field-id="node/1/title/en/layout_builder-default-non_component-c0858af7a82aba2ec7c7ed558d26d297babd406ce385e96d915d68e5fecbc963" class="field field--name-title field--type-string field--label-hidden">some page</span>

3. A block that outside the layout builder:

<div data-quickedit-entity-id="block_content/1" id="block-test-2" class="contextual-region block block-block-content block-block-content7d6f1fdf-86ec-4e36-8ef6-5fd4f42dc984" data-quickedit-entity-instance-id="0">
  
      <h2>Test</h2>
    <div data-contextual-id="block:block=test_2:langcode=en|block_content:block_content=1:changed=1572513265&amp;langcode=en" data-contextual-token="dr7X0PNb0twopWeXtlB0Ckw7pLP5vBE1EZERQ_JZ5xo" class="contextual"><button class="trigger visually-hidden focusable" type="button" aria-pressed="false">Open Test configuration options</button>

            <div data-quickedit-field-id="block_content/1/body/en/full" class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item quickedit-field"><p>test</p></div>
      

4. Other entities that outside the layout builder.

<article data-history-node-id="2" data-quickedit-entity-id="node/2" role="article" class="contextual-region node node--type-page node--view-mode-default clearfix" about="/node/2" typeof="schema:WebPage" data-quickedit-entity-instance-id="0">
  <header>    
            <h2 class="node__title">
        <a href="/node/2" rel="bookmark">
<span property="schema:name" data-quickedit-field-id="node/2/title/en/default" class="field field--name-title field--type-string field--label-hidden quickedit-field">test123</span>
🐛 Bug report
Status

Needs work

Version

10.1

Component
Layout builder 

Last updated about 13 hours ago

Created by

🇧🇪Belgium tamarpe

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

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

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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