fix(textfield,focus,ripple): fix textfield SSR

PiperOrigin-RevId: 566863561
This commit is contained in:
Elliott Marquez 2023-09-19 23:56:41 -07:00 committed by Copybara-Service
parent e1a04a158a
commit f576b60aec
2 changed files with 6 additions and 2 deletions

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {LitElement, PropertyValues} from 'lit';
import {isServer, LitElement, PropertyValues} from 'lit';
import {property} from 'lit/decorators.js';
import {Attachable, AttachableController} from '../../internal/controller/attachable-controller.js';
@ -87,6 +87,8 @@ export class FocusRing extends LitElement implements Attachable {
}
private onControlChange(prev: HTMLElement|null, next: HTMLElement|null) {
if (isServer) return;
for (const event of EVENTS) {
prev?.removeEventListener(event, this);
next?.addEventListener(event, this);

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {html, LitElement, PropertyValues} from 'lit';
import {html, isServer, LitElement, PropertyValues} from 'lit';
import {property, query, state} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';
@ -452,6 +452,8 @@ export class Ripple extends LitElement implements Attachable {
}
private onControlChange(prev: HTMLElement|null, next: HTMLElement|null) {
if (isServer) return;
for (const event of EVENTS) {
prev?.removeEventListener(event, this);
next?.addEventListener(event, this);