Skip to content

Commit

Permalink
fix(person): add method focusTextInput to person select (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbjornhaland authored Nov 20, 2024
1 parent bf61c90 commit ca2ea73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-turtles-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@equinor/fusion-wc-person': patch
---

Add `focusTextInput` method to person-select.
8 changes: 8 additions & 0 deletions packages/person/src/components/select/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ export class PersonSelectElement
element: new PersonSelectController(this),
};

focusTextInput() {
requestAnimationFrame(() => {
if (this.textInputElement) {
this.textInputElement.focus();
}
});
}

updated(props: Map<string, string | null | undefined>) {
if (props.has('selectedPerson')) {
this.controllers.element.attrSelectedPerson(
Expand Down

0 comments on commit ca2ea73

Please sign in to comment.