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

Add ability to pass Element itself to targetModal, not only 'id' of element #65

Closed
4esnog opened this issue Jan 25, 2018 · 11 comments
Closed
Labels

Comments

@4esnog
Copy link

4esnog commented Jan 25, 2018

Hello!

I am using shadow DOM, and if my modal is hidden inside it, document.getElementById('id-of-shadowed-element') can't select my modal.

I think, it would be handy to have the ability to pass not only id of element, but the element itself in options.targetModal.

Example:

const el = document.querySelector('my-component');
MicroModal.show(el);
@ghosh ghosh added this to the Next milestone Jul 21, 2019
@crtl
Copy link

crtl commented Aug 29, 2019

Is this still on the radar?

@Raidri
Copy link

Raidri commented Jan 28, 2020

I push this because I need that feature too for my web components. Is there maybe any new informations?

@ghosh ghosh removed this from the Next milestone Feb 20, 2020
@ghosh
Copy link
Owner

ghosh commented Mar 24, 2020

In an effort to keep this library lightweight and simple, have decided not to implement this feature. If there is a rising demand for this, am open to consider this again.

Thanks for your patience and understanding guys.

@pbek
Copy link

pbek commented Jul 7, 2020

Being able to pass an element as modal would also make this great library work inside of web-components.

Otherwise you'll just get a

Uncaught TypeError: Cannot read property 'setAttribute' of null
    at Modal.showModal (micromodal.es.js:138)

I guess a simple this.modal = typeof targetModal === "string" ? document.getElementById(targetModal) : targetModal would already solve this issue.

@pbek
Copy link

pbek commented Jul 7, 2020

@ghosh, I can confirm that changing this one line (https://github.com/ghosh/Micromodal/pull/351/files) allows the library to be used in web components.

image

pbek added a commit to pbek/Micromodal that referenced this issue Jul 14, 2020
@gstvribs
Copy link

any updates on this issue?

@obbap1
Copy link

obbap1 commented Mar 4, 2021

please any updates on this ?

@ronilaukkarinen
Copy link

Bumping this as well. Not a big change.

@benCoomes
Copy link

Another bump, if this library doesn't support shadow dom then I can't use it for the project I am working on. Which is a shame, because it is forward-looking with no dependencies and es6 module support.

@pbek
Copy link

pbek commented Apr 19, 2021

Just as a reminder, I have my PR #351 running in production since July 2020 without any issues in our web components.

@pbek
Copy link

pbek commented Oct 12, 2023

Any news or considerations on this, @ghosh?

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

No branches or pull requests

9 participants