Skip to content

Commit 91c45a4

Browse files
committed
fix build issue
1 parent 19b6dae commit 91c45a4

File tree

1 file changed

+7
-2
lines changed
  • packages/react-core/src/helpers

1 file changed

+7
-2
lines changed

packages/react-core/src/helpers/util.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,13 @@ export const canUseDOM = !!(typeof window !== 'undefined' && window.document &&
401401
*
402402
* @returns {boolean} - True if the glass theme class is present on the html element
403403
*/
404-
export const hasGlassTheme = (): boolean =>
405-
typeof document !== 'undefined' && document.documentElement.classList.contains('pf-v6-theme-glass');
404+
export const hasGlassTheme = (): boolean => {
405+
if (typeof document === 'undefined') {
406+
return false;
407+
}
408+
const classList = document.documentElement?.classList;
409+
return classList ? classList.contains('pf-v6-theme-glass') : false;
410+
};
406411

407412
/**
408413
* Calculate the width of the text

0 commit comments

Comments
 (0)