Skip to content

Commit

Permalink
fix(textfield,focus,ripple): fix textfield SSR
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 566863561
  • Loading branch information
Elliott Marquez authored and copybara-github committed Sep 20, 2023
1 parent e1a04a1 commit f576b60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion focus/internal/focus-ring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion ripple/internal/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f576b60

Please sign in to comment.