An error occurred while trying to edit an element: TypeError: Cannot read properties of undefined (reading 'dataset')

Created on 8 October 2024, 2 months ago

Problem/Motivation

I tried using edit_plus 1.0.x-dev on my layoutbuilder project that uses the navigation module.
If I click to edit something, nothing happens and I se this error in de console:

edit-plus.js?sl1alh:64 An error occurred while trying to edit an element: TypeError: Cannot read properties of undefined (reading 'dataset')
    at entity-form.js:64:62
    at new Promise (<anonymous>)
    at getLayoutBuilderEntityForm (entity-form.js:60:10)
    at Module.getForm (entity-form.js:44:14)
    at Drupal.EditPlus.EditableElementClicked (edit-plus.js?sl1alh:53:16)

Steps to reproduce

- have a project that uses layoutbuilder and navigation module
- enable edit_plus module
- click the edit button in the navigation bar
- click the edit button (with pencil icon) in the navigation bar
- click on a text on the page

Proposed resolution

no idea

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium flyke

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

Comments & Activities

  • Issue created by @flyke
  • πŸ‡§πŸ‡ͺBelgium flyke
  • πŸ‡§πŸ‡ͺBelgium flyke

    This was user error on my part! When trying to troubleshoot when LayoutBuilderEntityViewDisplay.php gets triggered to add the data attributes I eventually noticed that there is a sub-module edit_plus_lb that was not enabled.
    I enabled the edit_plus_lb module, which fixes this error.

  • πŸ‡§πŸ‡ͺBelgium flyke
  • πŸ‡ΊπŸ‡ΈUnited States tim bozeman

    Ahh yeah, I was wondering if it was a bad idea putting the module's integrations in sub-modules for this reason. I was debating whether or not edit+ and lb+ could be stand alone tools and opted for yes, though I'm not sure that was the right idea. Furthermore even if they can be used as stand alone we could just check if that other module is enabled where we need to and handle it without creating a sub-module. πŸ˜“

    There's also a lb_plus_edit_plus sub-module... 😬

  • πŸ‡§πŸ‡ͺBelgium flyke

    I do not use the lb_plus module at the moment.
    just edit_plus without edit_plus_lb did not work.

    So even if I don't use lb_plus, I still need the edit_plus_lb module for edit_plus to work.
    So maybe those two can be combined ? or what is the use case where one can use edit_plus without edit_plus_lb ?

    I fully support keeping edit_plus and lb_plus as two separate standalone modules so you can use one without the other.

Production build 0.71.5 2024