Skip to content

Commit 101b167

Browse files
committed
Don't require Element prop-type in Tooltip
Fixes #284 - Referencing `Element` can cause errors in SSR contexts - this lets `Tooltip`'s `target` prop fall back to `PropTypes.any` when `Element` is undefined.
1 parent 5a28ae7 commit 101b167

File tree

1 file changed

+4
-1
lines changed
  • packages/react-components/source/react/library/tooltips

1 file changed

+4
-1
lines changed

packages/react-components/source/react/library/tooltips/Tooltip.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const TOOLTIP_OFFSET = 6;
77

88
const propTypes = {
99
anchor: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
10-
target: PropTypes.instanceOf(Element).isRequired,
10+
target: (typeof Element === 'undefined'
11+
? PropTypes.any
12+
: PropTypes.instanceOf(Element)
13+
).isRequired,
1114
children: PropTypes.node,
1215
className: PropTypes.string,
1316
style: PropTypes.shape({}),

0 commit comments

Comments
 (0)