Bootstrap 5 Library Detection caused Bootstrap to be loaded twice

Created on 9 August 2023, 11 months ago
Updated 14 August 2023, 11 months ago

Problem/Motivation

I was using this with the Radix theme and had been including some but not all of the Bootstrap 5 javascript libraries in my theme. This caused an issue where parts of the library were loaded twice. The front page loaded bootstrap 5 via the CDN for the modal page and this resulted in the navbar collapse being ran twice and thus not being able to collapse.

Essentially if you click the navbar hamburger menu on mobile it stays visible due to the function being ran once locally and then via the library loaded by this app.

Steps to reproduce

Install a theme that loads a partial bootstrap 5 library, enable bootstrap 5 library automatic installation via modal_page config. Click navbar collapse on a modal page and it won't work.

Proposed resolution

I'm not sure if there is a way that the automatic detection could be improved to notice if any bit of bootstrap is loaded and not load it via CDN. The simple fix was to remove the automatic detection as bootstrap was being loaded by the theme by unchecking both. The modal page continued to work.

Remaining tasks

This could probably be marked as resolved I just wanted to provide some documentation of this issue in case someone else was running into this problem.

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States robbt

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

Comments & Activities

  • Issue created by @robbt
  • πŸ‡§πŸ‡·Brazil RenatoG Campinas

    @robbt , this one happens only on 5.0.3?

    I'm wondering if this is side-effect of the new release

  • πŸ‡ΊπŸ‡ΈUnited States robbt

    I am not sure, that was the release I started using it with. For what it's worth I think that only a few libraries from boostraps javascript were being loaded by my Radix theme. I didn't look into the code to see what specifically is checked by this module but if it's checking for the whole library then that could have been the issue.

    I just wanted to share my issue so that it is out there in case someone else runs into it and is scratching their head.

Production build 0.69.0 2024