Skip to content

Commit

Permalink
fix(Coachmark): ssr issues with instanceOf(HTMLElement) (carbon-des…
Browse files Browse the repository at this point in the history
…ign-system#5391)

* fix(Coachmark): ssr issues with htmlelement

* chore: remove unnecessary export
  • Loading branch information
matthewgallo authored and makafsal committed Jun 5, 2024
1 parent 4ee42ea commit 08e6585
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/ibm-products/src/components/Coachmark/Coachmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ export let Coachmark = forwardRef<HTMLElement, CoachmarkProps>(
}
);

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);

Expand Down Expand Up @@ -333,9 +338,7 @@ Coachmark.propTypes = {
overlayKind: PropTypes.oneOf(['tooltip', 'floating', 'stacked']),

overlayRef: PropTypes.shape({
current: PropTypes.instanceOf(
HTMLElement
) as PropTypes.Validator<HTMLElement | null>,
current: overlayRefType as PropTypes.Validator<HTMLElement | null>,
}),

/**
Expand Down

0 comments on commit 08e6585

Please sign in to comment.