Problem/Motivation
An error occurs when attempting to close a modal dialog using deprecated Dialog jQuery events.
Steps to reproduce
Open the bootstrap Modal dialog then try to close the dialog by close button.
Modal is not closing.
You will get the following error in the browser console.
An error occurred during the execution of the Ajax response: TypeError: Cannot read properties of undefined (reading 'dialog')
(anonymous) @ ajax.js?v=10.3.0:1143
dialog-deprecation.js?v=10.3.0:12 Uncaught TypeError: Cannot read properties of undefined (reading 'dialog')
at handle (dialog-deprecation.js?v=10.3.0:12:30)
at dispatch (jquery.min.js?v=3.7.1:2:40035)
at v.handle (jquery.min.js?v=3.7.1:2:38006)
at Object.trigger (jquery.min.js?v=3.7.1:2:70124)
at jquery.min.js?v=3.7.1:2:70726
at Function.each (jquery.min.js?v=3.7.1:2:3129)
at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
at ce.fn.init.trigger (jquery.min.js?v=3.7.1:2:70701)
at HTMLDivElement. (bs4_modal.dialog.js?v=10.3.0:148:17)
at HTMLDivElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
Proposed resolution
dialog-deprecation.js attempts to find the dialog instance at event.dialog, but that's not where the property exists. It's actually at $event.dialog
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 3457061-undefined-dialog.patch | 577 bytes | biancaradu27 |
| #2 | 3457061.patch | 1.15 KB | sunil chaurasiya |
Issue fork drupal-3457061
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
sunil chaurasiya commentedComment #3
sunil chaurasiya commentedComment #4
smustgrave commentedCan this be reproduced in 11.x also? the current "main" branch
MR should be opened against 11.x
What are the steps for reproducing?
Will also need test coverage
Comment #6
jhina.riv@gmail.com commentedComment #9
jhina.riv@gmail.com commentedComment #10
smustgrave commented11.x is the current development branch so fixes need to land their first, just FYI
Comment #12
jhina.riv@gmail.com commentedComment #13
smustgrave commentedThanks for turning to an MR but as mentioned in #10 this needs to go against 11.x as the current development branch
Also tagged for steps to reproduce and potential test coverage.
Comment #15
karlsheaThe MR needs to target 11.x, not 11.0.x. I rebased it on 11.x but I can't edit the MR.
Comment #17
elc commentedAttempted to fix the MR to work against 11.x-dev but it is too far broken. Appears to have been forked in the wrong branch and then merged across which has put it out of sync with everything and I can't find which of the hundreds of commits to purge to get it back to normal.
Comment #19
karlsheaThe MR can't be fixed until it's targeting the right branch, that's why it shows hundreds of commits.
Comment #20
karlsheaComment #22
finnsky commentedWhich bootstrap theme i have to test with?
Not even one of them cannot be applied on 11.x
Gonna test 10.3 with Bootstrap 5
Comment #23
finnsky commentedBootstrap 5 with 10.3 works fine https://gyazo.com/e8167563a2cc0868bcdc842037ba9be1
Comment #24
finnsky commentedBootstrap 3 with 10.3 also fine https://gyazo.com/1dd24fce160909e55df685d0171578b3
Comment #25
finnsky commentedProbably was meant this module?
https://www.drupal.org/project/bootstrap4_modal
Comment #26
finnsky commentedWith Bootstrap 4 modal no issues when anonymous user
https://gyazo.com/ce11b077b994b2fd529d4b0575f0119d
Some issues when admin. Digging..
Comment #27
finnsky commentedImo this should be done on level of module. It trigger jQuery events. But in fact they should be vanilla events.
Opened own issue
https://www.drupal.org/project/bootstrap4_modal/issues/3457776
Comment #28
finnsky commentedComment #29
finnsky commentedFixed in module ticket
Comment #30
elc commentedConfused. The file is in Drupal Core, not a contrib module?
Comment #31
finnsky commentedYes. Core has Backward compatibility for jQuery listeners but not for jQuery triggers.
It seems pretty weird to expect that events will work same if they triggered differently than in core.
Comment #33
biancaradu27 commentedReroll for version 10.3.x