3d092583eb
... for template caching
17 lines
408 B
JavaScript
17 lines
408 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
import { isTouchDevice } from "helpers/platform_helpers"
|
|
|
|
export default class extends Controller {
|
|
static targets = [ "mouse", "touch" ]
|
|
|
|
connect() {
|
|
this.#setup()
|
|
}
|
|
|
|
#setup() {
|
|
const touch = isTouchDevice()
|
|
if (this.hasMouseTarget) this.mouseTarget.autofocus = !touch
|
|
if (this.hasTouchTarget) this.touchTarget.autofocus = touch
|
|
}
|
|
}
|