braintree-web-drop-in
braintree-web-drop-in copied to clipboard
Please split up braintree.dropin.create() into separate initialize and mount
General information
- SDK/Library version: 1.27.0
- Environment: Sandbox
- Browser and Chrome/mac
Issue description
Please split up async braintree.dropin.create()
into async initialize()
and a sync mount()
.
That way I could background the initialize/async stuff on page load and not have to show a second spinner to display the payment form.
Additionally, because of the requirement the DOM element be empty to use (why not just empty it?), I can't easily set my own placeholder and it means I have to deal with a janky content shift:
- dropin container renders/added to dom
- page looks broken until drop-in renders its spinner (which is delayed for some reason)
- spinner renders and page content shifts to accommodate spinner height
- form renders. page content shifts again to accommodate the different form height
If you must continue with things that way please add load/ready events so I can show and hide my own wait ui.
As it stands right now my current plan is to render the form to a container that is not attached to the dom and then attach/detach it when the payment step is rendered. Which is pretty hacky.
I'm marking this issue with the label for v2. I think you make a lot of good points, and we'll definitely take them into consideration for the design of v2 of the Drop-in SDK.