-
Notifications
You must be signed in to change notification settings - Fork 157
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
Mounting to an element in ShadowDOM throws error on confirmCardPayment #143
Comments
Unfortunately it's not as simple as updating some "query selectors". There is a fundamental incompatibility between the We do have some ideas on how to work around this limitation, but it would require a complete overall of our iframe communication. In the mean time, you can work around this yourself by using Btw, the Element mounted in the Shadow DOM is actually not functional at all. Not being able to use it with |
Aaah I see, yea that makes it more complicated than I anticipated. I'll go with the slots workaround, that's definitely workable for my use case. Also hey Benny, I totally forgot you wrote that lib 👍 will check it out |
FYI, we just added some detection to report an error when mounting an Element in the Shadow DOM. It should prevent false assumptions that the element is functional. |
I just did a quick test on https://bennypowers.dev/stripe-elements/?path=/docs/fallback-to-stripe-elements--enter-a-publishable-key and it looks like |
Summary
Mounting the card element to some place in a shadowRoot works just fine. Doing a confirmCardPayment then throws an error asking if the card element is still mounted. I'm assuming this is due to poor shadow DOM support. Again, an assumption, but there's probably a query selector on your end somewhere searching for the mounted Stripe card iframe or the private input inside it? Normal query selectors do not penetrate shadow DOM :\ but the global Stripe instance probably should be able to do this if it wants to scrape for a mounted Stripe element.
The reason I want shadow DOM support is because I want to create a custom element for my Stripe payment form. Then I can encapsulate my styles in this component and not risk styles leaking inward/outward relative to my application.
Other information
Happens in latest Google Chrome (w10)
The text was updated successfully, but these errors were encountered: