Skip to content

Commit

Permalink
fix(textfield): calling focus on textfield with a leading icon focuse…
Browse files Browse the repository at this point in the history
…s the input

PiperOrigin-RevId: 574285365
  • Loading branch information
Elliott Marquez authored and copybara-github committed Oct 17, 2023
1 parent c0e39d9 commit 8f999d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions textfield/internal/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,4 +779,10 @@ export abstract class TextField extends LitElement {
formStateRestoreCallback(state: string) {
this.value = state;
}

override focus() {
// Required for the case that the user slots a focusable element into the
// leading icon slot such as an iconbutton due to how delegatesFocus works.
this.getInputOrTextarea().focus();
}
}

0 comments on commit 8f999d4

Please sign in to comment.