primevue icon indicating copy to clipboard operation
primevue copied to clipboard

[v4] InputNumber: Missing type declaration for buttons leads to form submit on button click

Open m-meier opened this issue 9 months ago • 0 comments

Describe the bug

In PrimeVue v4 the InputNumber component uses normal html button elements for increase/decrease buttons. However, they lack a type specification. This leads to the problem that clicking the buttons will perform a form submit when placed within a form. This behavior might be browser specific, but is reproduceable in Google Chrome on Windows

According to the w3c spec: The attribute's missing value default and invalid value default are both the Submit Button state.

Reproducer

https://stackblitz.com/edit/vitejs-vite-wk6pwr?file=src%2FApp.vue

PrimeVue version

4.0.0-beta.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Google Chrome

Steps to reproduce the behavior

In the stackblitz code it will perform a form post when you click on the button in the InputNumber enclosed in the form (white page), however it will work flawlessly when used outside of a form element.

Expected behavior

Never perform a form submit.

m-meier avatar May 08 '24 12:05 m-meier