Extract isInput into a helper

This commit is contained in:
Stanko K.R.
2025-08-19 08:20:49 +02:00
parent 7a17f36228
commit 30f0079fc2
3 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -1,5 +1,6 @@
import { Controller } from "@hotwired/stimulus"
import { post } from "@rails/request.js"
import { isInput } from "helpers/html_helpers"
export default class extends Controller {
static targets = [ "turboFrame" ]
@@ -41,8 +42,7 @@ export default class extends Controller {
const activeElement = document.activeElement
if (activeElement) {
const usingInput = activeElement.closest("input, textarea, lexical-editor")
return !usingInput
return !isInput(activeElement)
} else {
return true
}