JS Error when not using Toolbar+ module: Cannot read properties of null (reading 'style')

Created on 25 July 2024, 8 months ago

Problem/Motivation

Enabling and using lb_plus module creates this JS error when I view a node:

drupal.js?v=10.3.1:64 Uncaught TypeError: Cannot read properties of null (reading 'style')
    at Object.openSidebar (lb-plus-ui.js?sh6i9j:67:15)
    at lb-plus-ui.js?sh6i9j:25:48
    at Array.forEach (<anonymous>)
    at Object.attach (lb-plus-ui.js?sh6i9j:21:64)
    at drupal.js?v=10.3.1:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=10.3.1:162:34)
    at drupal.init.js?v=10.3.1:32:12
    at HTMLDocument.listener (drupal.init.js?v=10.3.1:20:7)

it comes from lb-plus-ui.js:

      const wrapper = document.getElementById('toolbar-plus-sidebar');
      wrapper.style.display = 'block';

After some googling, I think the only way where 'toolbar-plus-sidebar could come from is from the toolbar_plus module, which My project does not have.

Steps to reproduce

- Enable lb_plus
- Do not use toolbar_plus module

Proposed resolution

Maybe split up tje JS code that needs toolbar_plus module, and only attach it if that module is enabled, or just remove code referencing to toolbar_plus module altogether.

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium flyke

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