remove comment and move logic to method
This commit is contained in:
@@ -34,11 +34,7 @@ export default class extends Controller {
|
||||
showModalAndSubmit(event) {
|
||||
this.showModal()
|
||||
this.formTarget.requestSubmit()
|
||||
|
||||
// Restore focus to search input after turbo frame loads
|
||||
this.turboFrameTarget.addEventListener("turbo:frame-load", () => {
|
||||
this.searchInputTarget.focus()
|
||||
}, { once: true })
|
||||
this.#restoreFocusAfterTurboFrameLoads()
|
||||
}
|
||||
|
||||
showModal() {
|
||||
@@ -56,6 +52,12 @@ export default class extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
#restoreFocusAfterTurboFrameLoads() {
|
||||
this.turboFrameTarget.addEventListener("turbo:frame-load", () => {
|
||||
this.searchInputTarget.focus()
|
||||
}, { once: true })
|
||||
}
|
||||
|
||||
#loadTurboFrame() {
|
||||
this.turboFrameTarget.src = this.searchUrlValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user