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

target argument is getting the parent on Safari. OnShow method. #496

Open
isaacherrera47 opened this issue Feb 16, 2022 · 3 comments
Open

Comments

@isaacherrera47
Copy link

MicroModal.init({ onShow: this.handleOpenModal.bind(this), });

Arguments passed to this function suppose to be modal and target, target is passing the body instead on safari browser.

@RTSchriner
Copy link

RTSchriner commented Mar 18, 2022

I am experiencing the same thing. In Chrome the target is correct but in Safari the target is the body.

@imagehat
Copy link

The problem is here because document.activeElement does not work in Safari, it just returns the body.

It's not in the docs but there is a third parameter which is the original event, so you can grab all three parameters onShow: function(modal, trigger, event) then use event.target instead.

@suxscribe
Copy link

Same in Firefox 109

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

4 participants