I opened a ticked to braintree (#3469599) but it seems they are private and not visible by the community and this could be useful for someone else.
I am trying to implement braintree hosted fields in a Lightning Web Component (Salesforce), running in a Community (Lightning Web Runtime / Lightning Locker disabled).
The issue is that the iframes are inserted outside of the component (c-braintree_payment). Braintree is inserting a slot at the proper location in the DOM (inside the div given as input) instead of putting the iframe inside. The slot is reffering to an other slot which braintree inserted in the parent element, and this slot refers to an other slot inserted in his parent, and so on.
Finally at the level of the webruntime-app, braintree is inserting the iframe with the input.
What is happening might actually be what is described in the last comment of that post :
The fix was to check if the container being passed existed in the shadow DOM, and if it does, add slot elements into the container and the iframes in divs referencing those slots on the main page. This allows the iframes to communicate with each other even when inside the shadow DOM.
But in the case of Lightning Web Components, it might not be working as intended. Any help would be greatly appreciated !
@munchj, thanks for bringing this up to us. We are able to see the behaviour in the example you linked. We'll take a look at this and let you know what we find.
General information
Issue description
I opened a ticked to braintree (#3469599) but it seems they are private and not visible by the community and this could be useful for someone else.
I am trying to implement braintree hosted fields in a Lightning Web Component (Salesforce), running in a Community (Lightning Web Runtime / Lightning Locker disabled).
A minimal example is live at https://braintree-dev-developer-edition.eu44.force.com/
The issue is that the iframes are inserted outside of the component (c-braintree_payment). Braintree is inserting a slot at the proper location in the DOM (inside the div given as input) instead of putting the iframe inside. The slot is reffering to an other slot which braintree inserted in the parent element, and this slot refers to an other slot inserted in his parent, and so on. Finally at the level of the webruntime-app, braintree is inserting the iframe with the input.
Am I doing something wrong ? I saw that braintree is supporting web components starting at version 3.64.1 https://github.com/braintree/braintree-web/issues/495
What is happening might actually be what is described in the last comment of that post :
But in the case of Lightning Web Components, it might not be working as intended. Any help would be greatly appreciated !
braintree_payment.html
braintree_payment.js