Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] Enter key submits form even when keyboardShortcuts: false #6757

Open
daneprime8 opened this issue Feb 23, 2019 · 3 comments
Open

[Form] Enter key submits form even when keyboardShortcuts: false #6757

daneprime8 opened this issue Feb 23, 2019 · 3 comments

Comments

@daneprime8
Copy link

daneprime8 commented Feb 23, 2019

Creating a form and disabling keyboardShortcuts does not disable the enter key for form submit.

Expected case is that enter key will do nothing.

Testcase

https://jsfiddle.net/skwny/8be03nao/4/

@andrewleith
Copy link

Not sure if this is a bug or not. I think this setting turns off SUI's custom logic during form submit, but then by default the browser will submit a form when enter is pressed on an input. I think this is just the browser taking over.

@crispycrispycrispy
Copy link

crispycrispycrispy commented Feb 2, 2022

I think @andrewleith is right.

I fixed this issue by changing my button from this
<button class="ui primary fluid button" type="submit">Submit</button>
to
<div class="ui primary submit fluid button">Submit</div>

keyboardShortcuts: false worked after these changes

@andrewleith
Copy link

@crispycrispycrispy one thing to note is that this will make your button not accessible - a screen reader will not recognize it as a button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants