Handle form errors with a stimulus class
We need to keep the focus in place when submitting the form. We are using a data-turbo-permanent for that. We were rendering the error form with a turbo stream. The problem was that turbo streams ignore permanent elements as per this https://github.com/hotwired/turbo/pull/688, so the system wasn't updating the input field as expected. Handling this as the stimulus level will also help with managing additional error states (such as the one we need for confirmations).
This commit is contained in:
@@ -19,10 +19,6 @@ export default class extends Controller {
|
||||
event.target.select()
|
||||
}
|
||||
|
||||
reset(event) {
|
||||
this.element.reset()
|
||||
}
|
||||
|
||||
showPicker(event) {
|
||||
if ("showPicker" in HTMLInputElement.prototype) {
|
||||
event.target.showPicker()
|
||||
|
||||
Reference in New Issue
Block a user