HostedFields v3 do not render inside shadow root.
See original GitHub issueHi there,
I am trying to setup hosted fields inside a shadow container. The iframe loads as it should, <script>braintree.hostedFields.create();</script>
is injected but no label or input is rendered.
At the moment, I am tracing the issue but i’d appreciate more useful insights from the contributors.
My init code looks like:
...
braintree.hostedFields.create({
client: clientInstance,
styles: {},
fields: {
number: {
selector: '::shadow #card-number',
placeholder: '4111 1111 1111 1111'
},
cvv: {
selector: '::shadow #cvv',
placeholder: '123'
},
expirationDate: {
selector: '::shadow #expiration-date',
placeholder: 'MM/YYYY'
}
}
}, callback);
...
Thanks in advance, Sokratis
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Braintree hosted fields do not work inside iframe
I have tried to use Braintree hosted fields with Polymer but it didn't work (apparently braintree says no support yet) so I have...
Read more >Using shadow DOM - Web Components | MDN
High-level view · Shadow host: The regular DOM node that the shadow DOM is attached to. · Shadow tree: The DOM tree inside...
Read more >Your Checkout. Our iframes - Braintree
By default, Hosted Fields will only render static input states. For example, a focus event on the input will not propagate out to...
Read more >Getting math to render inside custom elements (shadow DOM)
Hi. Custom elements are a pretty important par of the book i'm writing, but i'm facing difficulty getting math to render at all....
Read more >braintree-web/CHANGELOG.md - UNPKG
544, * Hosted Fields. 545, * Fix issue where some series 2 Mastercard bin ranges were not being detected (internal assets for v3.19.1...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@crookedneighbor Just in case you’re wondering and for anyone else out there…
You CAN use braintree and polymer 2 together, you just have to put the form outside the shadow dom and use
<slot> to tell polymer where it should end up
. This way the braintree lib can find the elements to bind the iframes to, and you still get your form showing up where you want it.Example:
In index.html add your braintree-fields inside your app container
<my-app>
then in
<my-app>
<slot id="#braintree-fields">
where you want to put it.Finally, in
<my-checkout>
just slot in any content (which should be only the#braintree-fields
)@paulhulatt please jump in on the issue in the Drop-in repo: https://github.com/braintree/braintree-web-drop-in/issues/296