fast icon indicating copy to clipboard operation
fast copied to clipboard

fix: button does not work as expected inside a form

Open simonxabris opened this issue 2 years ago • 0 comments

🐛 Bug Report

When fast-button is inside a form element, navigating to a type="button" via the keyboard and hitting Enter submits the form and doing the same on a type="submit" (either explicit or implicit submit) submits the form twice.

💻 Repro or Code Sample

You can reproduce it here: https://stackblitz.com/edit/vitejs-vite-86nklr?file=src/main.ts

Open up the console and focus the buttons with the keyboard, hit Enter and observe the logs in the consolde.

🤔 Expected Behavior

I expected the fast-button to behave as a native HTML button would inside form elements.

😯 Current Behavior

Desribed above.

💁 Possible Solution

I found the bug in the code, I'll open a PR.

🔦 Context

This hurts the keyboard a11y in the forms that we're developing.

simonxabris avatar Apr 11 '23 06:04 simonxabris