From ca2ea738ba33c96e519c196c7c814138c1653d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20H=C3=A5land?= Date: Wed, 20 Nov 2024 12:56:52 +0100 Subject: [PATCH] fix(person): add method focusTextInput to person select (#1653) --- .changeset/funny-turtles-cover.md | 5 +++++ packages/person/src/components/select/element.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/funny-turtles-cover.md diff --git a/.changeset/funny-turtles-cover.md b/.changeset/funny-turtles-cover.md new file mode 100644 index 000000000..d27aa844e --- /dev/null +++ b/.changeset/funny-turtles-cover.md @@ -0,0 +1,5 @@ +--- +'@equinor/fusion-wc-person': patch +--- + +Add `focusTextInput` method to person-select. diff --git a/packages/person/src/components/select/element.ts b/packages/person/src/components/select/element.ts index 7df19af62..6fe80343a 100644 --- a/packages/person/src/components/select/element.ts +++ b/packages/person/src/components/select/element.ts @@ -166,6 +166,14 @@ export class PersonSelectElement element: new PersonSelectController(this), }; + focusTextInput() { + requestAnimationFrame(() => { + if (this.textInputElement) { + this.textInputElement.focus(); + } + }); + } + updated(props: Map) { if (props.has('selectedPerson')) { this.controllers.element.attrSelectedPerson(