fix(text-field): fix focus forwarding for SSR

PiperOrigin-RevId: 438425873
This commit is contained in:
Liz Mitchell 2022-03-30 16:32:37 -07:00 committed by Copybara-Service
parent c401d43ffd
commit dcaa6a7ee3

View File

@ -103,13 +103,15 @@ export class TextField extends LitElement {
`;
}
protected handleClick() {
protected async handleClick() {
if (this.disabled) {
return;
}
if (!this.matches(':focus-within')) {
this.focus();
// TODO(b/210731759): replace with this.focus() once SSR supports
// delegating focus
(await this.input).focus();
}
}