We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19b6dae commit 91c45a4Copy full SHA for 91c45a4
packages/react-core/src/helpers/util.ts
@@ -401,8 +401,13 @@ export const canUseDOM = !!(typeof window !== 'undefined' && window.document &&
401
*
402
* @returns {boolean} - True if the glass theme class is present on the html element
403
*/
404
-export const hasGlassTheme = (): boolean =>
405
- typeof document !== 'undefined' && document.documentElement.classList.contains('pf-v6-theme-glass');
+export const hasGlassTheme = (): boolean => {
+ 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
+};
411
412
/**
413
* Calculate the width of the text
0 commit comments