Skip to content

Commit fdc7856

Browse files
authored
fix: don't submit form on autocomplete (#3554)
1 parent 8e7027e commit fdc7856

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/javascript/js/controllers/form_controller.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { Controller } from '@hotwired/stimulus'
22

33
// Connects to data-controller="form"
44
export default class extends Controller {
5-
submit() {
5+
submit(event) {
6+
// return if event.key is undefined preventing the form submit on autocomplete event
7+
if (!event.key) return
8+
69
this.element.requestSubmit()
710
}
811
}

0 commit comments

Comments
 (0)