Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal data-te-modal-dismiss not working if no data-te-toggle="modal" on page #1912

Open
dxks opened this issue Sep 5, 2023 · 2 comments
Open

Comments

@dxks
Copy link

dxks commented Sep 5, 2023

Describe the bug
After Upgrading from 1.0.0beta2 to beta3 or rc1 it is no longer possible to dismiss a modal with data-te-modal-dismiss.

As the Modals are shown programatically there is no data-te-toggle button. In the code the enableDismissTrigger function within the modal-component init has been removed. The overall init function just uses the data-te-toggle selector.

As soon as a button with data-te-toggle="modal" exists the dismiss trigger works again.

To Reproduce
follow the examples in documentation. This works fine.

Remove the button with data-te-toggle="modal" and the data-te-target="#id".
Reload the page.

Open the page programatically. Modal will be shown. But closing based on the dismiss-trigger not working.

Expected behavior
A modal should be closable from inside with data-te-modal-dismiss either if it is toggle by button or opened programatically.

Actual behavior
data-te-modal-dismiss only working if not using programatically modal opening.

Show your code
The following code is used (ES) to open the modal:

window.openModal = (id) => {
const el = document.getElementById(id)
if (typeof el != 'undefined' && el !== null) {
let modal = Modal.getInstance(el)
if (modal === null) {
modal = new Modal(el, {})
}
modal.show()
}
}

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome One
  • Version 101.0.4843.43

Make sure it is indeed an issue/bug report

Without the data-te-toggle-button only two click-listeners are registered to the dismiss-button. As soon as the toggle button is on the page 6 listeners are registered including the dismiss.te.modal uidEvent.

@juujisai
Copy link
Contributor

juujisai commented Sep 6, 2023

Hi, we'll try to fix this for the 1.0.0 release (11.09). It was working without any issues before right?

@dxks
Copy link
Author

dxks commented Sep 6, 2023

Hello juujisai. That's correct with beta2 it works fine. Starting with beta3 it stopped working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants