Skip to content

Commit

Permalink
Merge pull request #38806 from bernhardoj/fix/38292-tooltip-overlaps-…
Browse files Browse the repository at this point in the history
…desktop-header

Fix tooltip overlaps with the desktop header
  • Loading branch information
lakchote authored Mar 25, 2024
2 parents 19ed990 + dc05e77 commit 0a3cd81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/styles/utils/generators/TooltipStyleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import FontUtils from '@styles/utils/FontUtils';
import positioning from '@styles/utils/positioning';
// eslint-disable-next-line no-restricted-imports
import spacing from '@styles/utils/spacing';
// eslint-disable-next-line no-restricted-imports
import titleBarHeight from '@styles/utils/titleBarHeight';
import variables from '@styles/variables';
import type StyleUtilGenerator from './types';

Expand Down Expand Up @@ -181,11 +183,13 @@ const createTooltipStyleUtils: StyleUtilGenerator<GetTooltipStylesStyleUtil> = (

if (isTooltipSizeReady) {
// Determine if the tooltip should display below the wrapped component.
// If either a tooltip will try to render within GUTTER_WIDTH logical pixels of the top of the screen,
// If either a tooltip will try to render within GUTTER_WIDTH or desktop header logical pixels of the top of the screen,
// Or the wrapped component is overlapping at top-center with another element
// we'll display it beneath its wrapped component rather than above it as usual.
shouldShowBelow =
shouldForceRenderingBelow || yOffset - tooltipHeight < GUTTER_WIDTH || !!(tooltip && isOverlappingAtTop(tooltip, xOffset, yOffset, tooltipTargetWidth, tooltipTargetHeight));
shouldForceRenderingBelow ||
yOffset - tooltipHeight - POINTER_HEIGHT < GUTTER_WIDTH + titleBarHeight ||
!!(tooltip && isOverlappingAtTop(tooltip, xOffset, yOffset, tooltipTargetWidth, tooltipTargetHeight));

// When the tooltip size is ready, we can start animating the scale.
scale = currentSize;
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/titleBarHeight/index.desktop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 28;
1 change: 1 addition & 0 deletions src/styles/utils/titleBarHeight/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 0;

0 comments on commit 0a3cd81

Please sign in to comment.