Problem/Motivation
Bootstrap 5 has different attribute names for the modal options:
- data-dismiss --> data-bs-dismiss
- data-keyboard --> data-bs-keyboard
- data-backdrop --> data-bs-backdrop
However, the modal-page-modal.twig.html always uses the bs3 names, so dismiss buttons don't work and changing the keyboard / the backdrop configurations has no effect when using bs5.
Steps to reproduce
- Go to /admin/config/user-interface/modal-page/settings and select Bootstrap 5 in the version dropdown.
- Go to /admin/structure/modal and edit a modal
- On the Modal buttons tab, check "Display button X to close"
- On the Modal close tab, uncheck both "Close Modal pressing ESC key" and "Close Modal clicking outside the Modal" options.
Result:
The modal will show properly, but:
- The X button will not close the modal
- The overlay background will close the modal (the default bs5 behaviour)
- Pressing ESC will close the modal (the default bs5 behaviour)
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | AwesomeScreenshot-7_13_2023,6 55 57PM.mp4 | 1.83 MB | aldibier |
| #4 | 3326868-4.patch | 4.5 KB | jnlar |
Issue fork modal_page-3326868
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
avpadernoI am resetting the Assigned field, since it should be used from people who are going to work on the issue in the next hours, not from people who need more than 12 hours before starting to work on the issue or more than 12 hours to complete the work on the issue.
Comment #3
renatog commentedHello @ruthcj how are you?
Thanks a lot for using and for reporting. It helps a lot!
Yeah, good catch. We need to work on this.
My agenda is full on these days but seem that isn't so complex to fix so I'm putting the tag "Novice" to see if someone in the Drupal.org have interest to try to help contributing
Comment #4
jnlarComment #5
jnlarAttached a patch that'll alternate the data attributes, noticed a typo as well:
Which was affecting some logic in
js/modal-page.jsComment #6
renatog commented@jonarcher really good catch! Thanks a lot
@ruthcj could you verify if patch #4 solves your issue, please?
If yes I'll commit the fix for us
Thank you so much, team
Comment #7
shubham rathore commentedComment #8
shubham rathore commentedHi patch#4 work properly for me & resolve the issue.
Thank You
Comment #9
sahilgidwani commentedComment #10
sahilgidwani commented@RenatoG, I applied patch and it is working fine as per the problem description.
Comment #12
sahilgidwani commented@RenatoG, I have created a issue fork and applied patch and created MR so that it can be merged easily. Please review the PR.
Comment #13
sahilgidwani commentedComment #14
kevinquillen commentedThis is pretty major and needs to be fixed. Selecting Bootstrap 5 doesn't work at all, and since that is the latest version most people are probably going to select that.
Comment #15
kevinquillen commentedSetting back because there are new commits.
Comment #16
aldibierHi,
I've tested this fix using the branch with the latest commits and everything looks good.
This test was performed using Drupal 9.5 and Drupal 10.1 in both versions the fix works perfectly!
I'm attaching a video with all steps.
Comment #17
aldibierComment #19
renatog commentedThanks everyone