Uncaught TypeError in sidebar.js after updating to the latest Gin theme

Created on 8 July 2024, 4 months ago
Updated 13 August 2024, 3 months ago

Problem/Motivation

Steps to reproduce

  • Update the Gin theme to the latest version
  • Navigate to any page that utilizes the form--layout-builder-form--gin-lb.html.twig template.
  • Open the browser console to observe the JavaScript error.

Actual Result

The following error appears in the browser console:

drupal.js?v=10.3.1:64 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
    at Object.resizeInit (sidebar.js?sgbjhb:60:19)
    at sidebar.js?sgbjhb:19:63

This error indicates that the resizeInit function is trying to call addEventListener on a null element.

Additional Information

identified the problem in the form--layout-builder-form--gin-lb.html.twig template.
It seems that the resizeInit function in sidebar.js does not handle cases where the target element is null.
This issue is not only limited to the Gin Layout Builder β†’ module but is also present in the Gin β†’ theme itself. The theme should be more careful in initializing its environment to avoid such errors.

However i think we should fix this small bug on our side first.
Thank you

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada man-1982

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