Skip to content

Commit

Permalink
Merge pull request #19307 from parasharrajat/fix-crash
Browse files Browse the repository at this point in the history
[No QA] Fix Crash from undefined Tooltip wrapper
  • Loading branch information
Hayata Suenaga authored May 19, 2023
2 parents 3f32e3c + d84521b commit 75835a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/styles/getTooltipStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function computeHorizontalShift(windowWidth, xOffset, componentWidth, tooltipWid
* and the left edge of the wrapped component.
* @param {Number} yOffset - The distance between the top edge of the window
* and the top edge of the wrapped component.
* @param {Element} tooltip - The reference to the tooltip's root element
* @param {Element} [tooltip] - The reference to the tooltip's root element
* @returns {Boolean}
*/
function isOverlappingAtTop(xOffset, yOffset, tooltip) {
Expand All @@ -67,7 +67,7 @@ function isOverlappingAtTop(xOffset, yOffset, tooltip) {
const element = document.elementFromPoint(xOffset, yOffset);

// Ensure it's not the already rendered element of this very tooltip, so the tooltip doesn't try to "avoid" itself
if (!element || tooltip.contains(element)) {
if (!element || (tooltip && tooltip.contains(element))) {
return false;
}

Expand Down

0 comments on commit 75835a9

Please sign in to comment.