primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
9.75k stars 1.17k forks source link

InputNumber: Form does not submit on enter #4199

Open Anubarak opened 1 year ago

Anubarak commented 1 year ago

Describe the bug

Usually you can submit forms via enter on inputs. This works for default <input type="text"> as well as your InputText component - but it does not work for InputNumber

You can check the example link below, go to an input, press enter and see the alert "form submitted" Works for InputText but not for InputNumber

Reproducer

https://codesandbox.io/p/sandbox/primevue-demo-forked-mkztsw?file=%2Fsrc%2FApp.vue%3A8%2C38

PrimeVue version

3.30

Vue version

3.x

Language

ALL

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. go to https://codesandbox.io/p/sandbox/primevue-demo-forked-mkztsw?file=%2Fsrc%2FApp.vue%3A29%2C10-29%2C24
  2. go to the inputnumer component
  3. press enter
  4. see no form submit is triggered

Expected behavior

form should be submitted

mrichar1 commented 1 year ago

Just came to report a probably related issue with events - updates for InputNumber only occur when focus is lost, not when input happens, unlike InputText which works fine.

Equivalent sandbox showing the event issue (and confirming the original issue) here:

https://codesandbox.io/s/still-leaf-vc33d7?file=/src/App.vue

tugcekucukoglu commented 1 year ago

Please check https://github.com/primefaces/primevue/issues/506

mrichar1 commented 1 year ago

Thanks for the link to the explanation of why InputNumber is different from the other Input types.

The specific issue I have with this is that InputNumber therefore does not support 'as-you-type' validation. I could put a hook in to catch the input event, and then manually call vee-validate's validation functions on the data, but this seems like a horrible hack.

Happy to open this as a separate bug if it's too confusing having it here...

AniaKru95 commented 11 months ago

Also, it has impact on filtering table. Putting value in InputNumber and press enter does not always filter the table. Sometimes, after pressing 'enter', InputNumber field is cleared and table is not filtered, but sometimes is everything ok. InputText always works as expected.