Skip to content

Commit 9f82c0b

Browse files
author
Sara Dahan
committed
fix(label-group): wrap #labels getter with server check to avoid DOM access in SSR
1 parent 141781e commit 9f82c0b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

elements/pf-label-group/pf-label-group.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LitElement, html, type TemplateResult } from 'lit';
22
import { customElement } from 'lit/decorators/custom-element.js';
33
import { property } from 'lit/decorators/property.js';
44
import { classMap } from 'lit/directives/class-map.js';
5+
import { isServer } from 'lit';
56
import '@patternfly/elements/pf-button/pf-button.js';
67

78
import styles from './pf-label-group.css';
@@ -109,14 +110,12 @@ export class PfLabelGroup extends LitElement {
109110
private _categorySlotted?: HTMLElement[];
110111

111112
get #labels(): NodeListOf<PfLabel> | PfLabel[] {
112-
const isServer = typeof window === 'undefined' || !('document' in globalThis);
113113
if (isServer) {
114114
return [] as PfLabel[];
115115
}
116116
return this.querySelectorAll<PfLabel>('pf-label:not([slot]):not([overflow-label])');
117117
}
118118

119-
120119
#tabindex = RovingTabindexController.of(this, {
121120
getItems: () => [
122121
...Array.prototype.slice.call(

0 commit comments

Comments
 (0)