quasar icon indicating copy to clipboard operation
quasar copied to clipboard

q-btn type="submit" on Safari: @click does not trigger @submit on form

Open arcadeJHS opened this issue 7 years ago • 24 comments

Software version Quasar: v1.0.0-beta.17

What did you get as the error? q-btn type="submit" on Safari: when you click it nothing happens when you hit "Enter" the @submit function declared on is correctly triggered.

What were you expecting? click and "Enter" on submit button should perform the same.

JsFiddle Go to the official v1 documentation (https://v1.quasar-framework.org/vue-components/form) and try to use the basic form example in Safari. When you click the submit button nothing happens. When you hit "Enter" the form is activated as expected.

arcadeJHS avatar Apr 16 '19 13:04 arcadeJHS

Can confirm this is happening

nothingismagick avatar Apr 16 '19 13:04 nothingismagick

I am seeing seven errors in the safari webconsole:

Screen Shot 2019-04-16 at 15 25 17

Am building the docs locally to triage.

nothingismagick avatar Apr 16 '19 13:04 nothingismagick

I am not sure that error is related to @submit. I can see it in the docs page, but not in the associated pen.

arcadeJHS avatar Apr 16 '19 13:04 arcadeJHS

If I add this to the button rigged to submit, then it works as expected:

 @click.native="onSubmit"

nothingismagick avatar Apr 16 '19 13:04 nothingismagick

https://codepen.io/nothingismagick/pen/dLJNXe?&editable=true&editors=101

nothingismagick avatar Apr 16 '19 14:04 nothingismagick

Yeah, but I guess this way you are skipping the quasar form validation, and you have to implement it manually.

arcadeJHS avatar Apr 16 '19 14:04 arcadeJHS

I am working on a fix right now.

nothingismagick avatar Apr 16 '19 15:04 nothingismagick

So the workaround for now is to add the autofocus prop to <q-form>

My pen has been updated to reflect this. It doesn't hook on the click, but on the blur.

nothingismagick avatar Apr 16 '19 18:04 nothingismagick

So I think I figured it out, and its really ugly. Apparently a button type submit does not work in safari. It has to be an input type. I have a POC working where an input field type submit behaves appropriately in both chrome and safari.

nothingismagick avatar Apr 16 '19 19:04 nothingismagick

And just for completeness to collect the research (in case we revisit this and decide for some reason to solve a Safari problem that has been around for almost a decade at least):

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

One method of using a hidden input and then a label: https://stackoverflow.com/a/23456905

nothingismagick avatar Apr 16 '19 20:04 nothingismagick

@arcadeJHS Do NOT add @click events and force form submit. There's a bug in QBtn that I'll fix.

rstoenescu avatar Apr 16 '19 22:04 rstoenescu

Thank you very much @nothingismagick and @rstoenescu for your insights and help! So I will wait for your fix, @rstoenescu!

arcadeJHS avatar Apr 17 '19 06:04 arcadeJHS

Fix will be available in beta.18.

rstoenescu avatar Apr 17 '19 17:04 rstoenescu

Thank you!

arcadeJHS avatar Apr 17 '19 19:04 arcadeJHS

q-btn type="submit" on Safari: @click does not trigger @submit on form in v1.beta 20 again

ghost avatar May 03 '19 13:05 ghost

Fix will be available in beta.18.

in beta20 the bug is still here, or again here ?

Thank you for the grate framework!!!!

ghost avatar May 03 '19 13:05 ghost

@ReDeLe I just checked. It works correctly. Are you setting type="submit" on your QBtn?

rstoenescu avatar May 03 '19 16:05 rstoenescu

I am on Chrome with 1.05 and I've the same problem

I've a clean <q-form>, no other props.

Inside there are 2 inputs Then this


<q-btn flat label="Save"
                   type="submit"
                   color="primary" />

Clicking on 'Save' DO NOT trigger any form submission. nothing at all.

realtebo avatar Jul 18 '19 15:07 realtebo

@realtebo Codepen please (also OS, device)

pdanpdan avatar Jul 18 '19 16:07 pdanpdan

I'm having this same issue. Has this been resolved?

anubhavkamath avatar Oct 09 '19 22:10 anubhavkamath