Skip to content

Prevent search form from submit/reset when hitting enter/return key#80

Open
kmturley wants to merge 1 commit into
SteamDeckHomebrew:mainfrom
kmturley:bugfix/prevent-form-submit
Open

Prevent search form from submit/reset when hitting enter/return key#80
kmturley wants to merge 1 commit into
SteamDeckHomebrew:mainfrom
kmturley:bugfix/prevent-form-submit

Conversation

@kmturley
Copy link
Copy Markdown

If you hit enter/return on mobile or desktop, the entire page is reloaded, instead of running the search query. This PR fixes that.

It is a very common need to call event.preventDefault() or event.stopPropagation() inside event handlers. Although we can do this easily inside methods, it would be better if the methods can be purely about data logic rather than having to deal with DOM event details.

<!-- just the modifier -->
<form @submit.prevent></form>

https://vuejs.org/guide/essentials/event-handling#event-modifiers

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

Successfully merging this pull request may close these issues.

1 participant