Uncaught TypeError: Cannot read properties of undefined (reading 'bootstrap_version')

Created on 8 November 2024, about 1 month ago

Problem/Motivation

The modal is not displayed correctly when using a custom theme.

When I disable the "Show my height" option and set a delay of 3 seconds for the modal display, an error message appears on my site:

Uncaught TypeError: Cannot read properties of undefined (reading 'bootstrap_version')

This error prevents the modal from functioning as expected within the custom theme.

Steps to reproduce

  1. In the modal configuration, disable the "Show my height" option.
  2. Set a delay of 3 seconds for the modal to display.
  3. Load the page with a custom theme and observe the console output.

Expected result: The modal should display correctly after the set delay without any errors.

Actual result: An error appears in the console: Uncaught TypeError: Cannot read properties of undefined (reading 'bootstrap_version').

Proposed resolution

To ensure that the required variables are available for the modal, I suggest moving the bootstrap_version and check_load_bootstrap_automatically variables into the hook_page_attachments. This change would ensure that these variables are consistently accessible within the modal-page library, regardless of theme configurations.

Environment

Drupal: 10.3.5
Modal Page: 5.1.0
PHP: 8.1.28
Database: MariaDB 10.4.33

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇻🇪Venezuela joseft40 Mérida

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

Comments & Activities

Production build 0.71.5 2024