From 9a4c0d576db6ca86a06ec04e6520bd5bd598fbd5 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 20 Nov 2022 16:30:45 +0100 Subject: [PATCH] Add Stimulus autofocus controller --- .../retrospring/controllers/autofocus_controller.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/javascript/retrospring/controllers/autofocus_controller.ts diff --git a/app/javascript/retrospring/controllers/autofocus_controller.ts b/app/javascript/retrospring/controllers/autofocus_controller.ts new file mode 100644 index 00000000..a0e423c5 --- /dev/null +++ b/app/javascript/retrospring/controllers/autofocus_controller.ts @@ -0,0 +1,7 @@ +import { Controller } from '@hotwired/stimulus'; + +export default class extends Controller { + connect(): void { + (this.element as HTMLInputElement).focus(); + } +}