From d9fdd1266dc54a6ddef55c652443e5d9c6789cf9 Mon Sep 17 00:00:00 2001 From: Matt Gallo Date: Tue, 4 Jun 2024 11:06:43 -0400 Subject: [PATCH] fix(Coachmark): ssr issues with `instanceOf(HTMLElement)` (#5391) * fix(Coachmark): ssr issues with htmlelement * chore: remove unnecessary export --- .../ibm-products/src/components/Coachmark/Coachmark.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/ibm-products/src/components/Coachmark/Coachmark.tsx b/packages/ibm-products/src/components/Coachmark/Coachmark.tsx index 371f763d84..bafacb3203 100644 --- a/packages/ibm-products/src/components/Coachmark/Coachmark.tsx +++ b/packages/ibm-products/src/components/Coachmark/Coachmark.tsx @@ -277,6 +277,11 @@ export let Coachmark = forwardRef( } ); +const overlayRefType = + typeof HTMLElement === 'undefined' + ? PropTypes.object + : PropTypes.instanceOf(HTMLElement); + // Return a placeholder if not released and not enabled by feature flag Coachmark = pkg.checkComponentEnabled(Coachmark, componentName); @@ -333,9 +338,7 @@ Coachmark.propTypes = { overlayKind: PropTypes.oneOf(['tooltip', 'floating', 'stacked']), overlayRef: PropTypes.shape({ - current: PropTypes.instanceOf( - HTMLElement - ) as PropTypes.Validator, + current: overlayRefType as PropTypes.Validator, }), /**