I'm frustrated when I'm unable to use <div id="ton-connect"> to place the Wallet Connect button inside a HTML form.
If I do so, the generated <button> tag has no explicit type attribute and as such is treated as a form submit button. When user presses Enter in an input field to submit the form, the Wallet Connect UI pops up undesirably.
Type any number in the input field under "Deposit amount"
Press Enter on the keyboard to submit the form (don't click "Submit").
Expected: only alert message shows.
Actual result: alert shows and Wallet Connect UI appears, too.
Describe the solution you'd like
Ideally, I would like <div id="ton-connect"> to generate <button type="button"> by default, and for those rare occasions when it actually needs to be a submit button, allow to override button type with <div id="ton-connect" data-button-type="submit">.
Describe alternatives you've considered
As a backwards compatible solution, just copy data-button-type attribute into <button type> if it's provided. Keep the default behavior unchanged (no explicit type).
Additional context
At first I was thinking it's a shortcoming in @townsquarelabs/ui-vue and reported it there:
Is your feature request related to a problem?
I'm frustrated when I'm unable to use
<div id="ton-connect">
to place the Wallet Connect button inside a HTML form.If I do so, the generated
<button>
tag has no explicittype
attribute and as such is treated as a form submit button. When user presses Enter in an input field to submit the form, the Wallet Connect UI pops up undesirably.Reproduction:
Expected: only alert message shows.
Actual result: alert shows and Wallet Connect UI appears, too.
Describe the solution you'd like
Ideally, I would like
<div id="ton-connect">
to generate<button type="button">
by default, and for those rare occasions when it actually needs to be a submit button, allow to override button type with<div id="ton-connect" data-button-type="submit">
.Describe alternatives you've considered
As a backwards compatible solution, just copy
data-button-type
attribute into<button type>
if it's provided. Keep the default behavior unchanged (no explicit type).Additional context
At first I was thinking it's a shortcoming in
@townsquarelabs/ui-vue
and reported it there:https://github.com/TownSquareXYZ/tonconnect-ui-vue/issues/16
but then I figured it's an upstream problem.