Skip to content

Commit

Permalink
[BUGFIX] Access trigger element in modal correctly
Browse files Browse the repository at this point in the history
$(this) does not work in TypeScript, as this is bound to the class or the
method, but never to the element. Thus, the target element is fetched
from the event.

Resolves: #84138
Releases: master
Change-Id: I05545d19f5cb10adc3678fa81d81e3b181047bc4
Reviewed-on: https://review.typo3.org/56007
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
andreaskienast authored and lolli42 committed Mar 5, 2018
1 parent 780c302 commit b3ef7c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions typo3/sysext/backend/Resources/Private/TypeScript/Modal.ts
Expand Up @@ -430,14 +430,14 @@ class Modal {
});

// Remove modal from Modal.instances when hidden
currentModal.on('hidden.bs.modal', (): void => {
currentModal.on('hidden.bs.modal', (e: JQueryEventObject): void => {
if (this.instances.length > 0) {
const lastIndex = this.instances.length - 1;
this.instances.splice(lastIndex, 1);
this.currentModal = this.instances[lastIndex - 1];
}
currentModal.trigger('modal-destroyed');
$(this).remove();
$(e.currentTarget).remove();
// Keep class modal-open on body tag as long as open modals exist
if (this.instances.length > 0) {
$('body').addClass('modal-open');
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Resources/Public/JavaScript/Modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b3ef7c6

Please sign in to comment.