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

Issue fork drupal-3457061

Command icon 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

Sunil Chaurasiya created an issue. See original summary.

sunil chaurasiya’s picture

Assigned: sunil chaurasiya » Unassigned
Status: Active » Needs review
StatusFileSize
new1.15 KB
sunil chaurasiya’s picture

Title: Bootstrap Modal dialog closing issue after 10.3.0 Update » Bootstrap Modal dialog Not closing after 10.3.0 Update
smustgrave’s picture

Version: 10.3.x-dev » 11.x-dev
Status: Needs review » Needs work
Issue tags: +Needs steps to reproduce, +Needs tests

Can 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

jhina.riv@gmail.com made their first commit to this issue’s fork.

I don't know why the patch in the comment #2 doesn't work when applied via Composer, but this will work.

jhina.riv@gmail.com’s picture

Issue summary: View changes
StatusFileSize
new613 bytes

jhina.riv@gmail.com’s picture

Version: 11.x-dev » 10.3.x-dev
smustgrave’s picture

11.x is the current development branch so fixes need to land their first, just FYI

jhina.riv@gmail.com’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Thanks 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.

KarlShea made their first commit to this issue’s fork.

karlshea’s picture

The MR needs to target 11.x, not 11.0.x. I rebased it on 11.x but I can't edit the MR.

ELC changed the visibility of the branch 3457061-bootstrap-modal-ajax-dialog to hidden.

elc’s picture

Version: 10.3.x-dev » 11.x-dev

Attempted 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.

karlshea’s picture

The MR can't be fixed until it's targeting the right branch, that's why it shows hundreds of commits.

karlshea’s picture

Issue summary: View changes
Issue tags: -Needs steps to reproduce

finnsky made their first commit to this issue’s fork.

finnsky’s picture

Which 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

finnsky’s picture

finnsky’s picture

finnsky’s picture

Probably was meant this module?

https://www.drupal.org/project/bootstrap4_modal

finnsky’s picture

With Bootstrap 4 modal no issues when anonymous user
https://gyazo.com/ce11b077b994b2fd529d4b0575f0119d

Some issues when admin. Digging..

finnsky’s picture

Imo 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

finnsky’s picture

Status: Needs work » Postponed
finnsky’s picture

Status: Postponed » Closed (works as designed)

Fixed in module ticket

elc’s picture

Confused. The file is in Drupal Core, not a contrib module?

finnsky’s picture

Yes. 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.

finnsky changed the visibility of the branch 11.x-3457061-modal-dialog to hidden.

biancaradu27’s picture

StatusFileSize
new577 bytes

Reroll for version 10.3.x