themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.55k stars 715 forks source link

Cannot closed programatically opened modals by clicking on 'x' #652

Closed pavitrakumar78 closed 10 months ago

pavitrakumar78 commented 11 months ago

Clicking on the close button of models opened via JS initialization does not work.

To Reproduce Steps to reproduce the behavior: Initialize a modal via JS https://flowbite.com/docs/components/modal/#example

Open the model and to close it by clicking on the 'x' button at the top right corner.

Expected behavior modal should close

Desktop (please complete the following information):

azeiteiro commented 11 months ago

Same issue here.

The close button only works when the modal is initialized via data HTML attributes, otherwise, if the exact modal is initialized via javascript (new Modal()) the close buttons do not fire any action.

zoltanszogyenyi commented 10 months ago

Hey @pavitrakumar78 @azeiteiro,

With the new Instance Manager from Flowbite v2.0 you can now access the modal instance even if it's created via data attributes.

Please check out the following resources:

https://flowbite.com/docs/getting-started/javascript/ https://github.com/themesberg/flowbite/issues

Cheers, Zoltan