Problem/Motivation
Drupal 11 ships with jQuery 4.
The module allows using Bootstrap 3, but that doesn't support jQuery 4.
Because of this, when enabling the default modal (thank_you_for_installing_modal_page) with the default settings (Bootstrap 3) on a D11 site, an infinite reload loop occurs. The reason is a reload in the module's js that will be looped because Bootstrap never initializes.
Steps to reproduce
On a D11 site (tested on 11.2.2, but all core versions should reproduce this that use jQuery 4) install the module.
Go to /admin/structure/modal and edit thank_you_for_installing_modal_page modal.
Save the modal (so it becomes enabled), the next page will reload infinitely.
Proposed resolution
Not sure about the resolution, seems like Bootstrap 3 is not supported in D11 because of the jQuery version.
The page reload after the ajax call should be also revised IMO (not sure what's the purpose of that).
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3536267-13.patch | 3.28 KB | renatog |
Comments
Comment #2
renatog commentedNice catch! Thanks a lot for reporting that
Increasing the priority
Comment #3
renatog commentedComment #5
renatog commentedMoved the fix to the dev branch
Keeping only BS5 on D11 (Modal 6)
It was very important! Thank you so much @keszthelyi
Comment #8
renatog commentedReverted because Removing BS3 from Modal 6 isn't a good solution
Could exists sites with Modal 6 running on Drupal 10 which allows BS3
We can create a solution to verify:
Comment #9
renatog commentedComment #10
renatog commentedAgreed
I've thinking about that as well
The idea was:
P.S. It was the initial idea, but I'm open to review that
Comment #11
keszthelyi commentedHi @renatog
Just my two cents: I think removing Bootstrap 3 support on version 6 was the best idea. Bootstrap 3 is not supported by even Bootstrap, it reached end of life, sites should update their bootstrap version and they will need to do it anyway to follow core.
Version 6 of modal_page is a new major version and is still in beta, so it is the perfect time to remove support as it can introduce non-BC changes according to semantic versioning rules.
Comment #12
keszthelyi commentedYes, in the meantime I also figured out what is the purpose of that page reload since I wrote that in the IS.
I think it would be worth considering other solution instead of that though. Not sure if modal_page's js should guess what should happen and what js to load (because as I understand that's the purpose of that reload: if bootstrap is not available let's reload the page with the cdn). Maybe a better direction would be to let the site builders decide how they configure the module and explicitly set what library to load (is it the cdn vs library is already loaded by the theme).
One idea that comes to mind if it would be configurable to load or not the cdn according to active theme, like a conditional. Our use case for example: I'd like to load the cdn version only if the active theme is claro let's say (so we're on admin pages and bootstrap is not available), but otherwise the site's theme is based on bootstrap, so we don't need the cdn. So there could be configuration for load cdn: 1. always 2. if active theme is ... 3. if active theme is not ... or something similar. Then it would be all decided by configuration and there would be no need to check in js, call ajax and do page reloads: it would be the responsibilty of the user who configures the module to select the option they need.
Comment #13
renatog commentedAgreed to #11
Based on that, created a separated issue #3556808: Remove BS3 from Modal 6 to handle the BS3 Removal (will be necessary more effort since has references on JS, Twig, PHP, etc)
For now, posting a quick-fix
Honestly isn't the best solution ever, however it works, until the the BS3 removal is completed
Comment #15
renatog commentedMoved the fix to the dev branch
The BS3 removal we can handle on #3556808: Remove BS3 from Modal 6
Released at: https://www.drupal.org/project/modal_page/releases/6.0.0-beta6
Thanks a lot @keszthelyi
Comment #17
renatog commentedYeah, it really can be better 🤔
Comment #18
renatog commentedAnother point:
I'm thinking about drop support to D11 on Modal 5.1.x
5.1.x with support for D11 makes hard to maintain
My initial draft is something like that:
So remove support for 5.0.x (it'll helps to have more time to maintain)
5.1.x supports D10 and receive bugfixes. Without new features and without support for D11. If someone needs to use Modal on D11 can upgrade to 6.0.x
6.0.x with support to Drupal 11 and new features
Edit: the problem is that 5.1.x is already marked as supported on D11 so it’s considerable the “stable version” currently
So many variables to think
Anyway if the support for D11 still on D11 I’ll need to move this fix and JS cookie there as well
Comment #19
keszthelyi commentedRe #18
Removing support for D11 in 5.1 is problematic indeed, as it's the stable version and already supports D11. So this could cause issues for projects using that version and already on D11. I would avoid that or at least not until 6 has a stable version. Hopefully, there won't be too many issues with 5.1 in the future to keep D11 support there.
Comment #20
renatog commentedYeah, agreed
I’m with that in mind,
6.x supported, beta release, new features, supports D11, BS5 and Dialog API
5.1.x supported, stable release, supports D11, BS3 and BS4
5.0.x deprecated, sunset at Jan, 2026
Thanks a lot @keszthelyi
Comment #22
renatog commentedAs talked above, we're keeping support for D11 on Modal 5.1, so I moved this fix to that version as released a new version
https://www.drupal.org/project/modal_page/releases/5.1.4
Thanks @keszthelyi and @@fran-seva