Open CoreyBurkhart opened 4 years ago
MicroModal.init({
onClose: () => { console.log('close') }
})
no?
Calling MicroModal.show('my-modal')
seems to clear any configuration set from MicroModal.init({ options... })
A work around that seems to work is to not use init
if you need to use show
but then you can't use data-micromodal-trigger
so you need to wire up your own event handlers. Or pass in the same options for init
and show
!
@mattgaspar 's second workaround worked for me! I was doing init
with a bunch of options I needed and then manually displaying my modal via show
, only to discover none of my options were being used. It's really quite baffling that calling show
or hide
would nuke the config options.
It'd be vastly more intuitive and easy to work with this library if the configuration options were persistent and show
or close
didn't delete them.
It'd be vastly more intuitive and easy to work with this library if the configuration options were persistent and show or close didn't delete them.
I agree. Global configuration could be overridden with configuration passed to show
. But if nothing is passed to show
global configuration should be used instead.
Repo
Expectation: "close" will be logged to the console Actual: Nothing is logged to the console
When I provide the config to
show
,onClose
gets called properly