Skip to content

Tooltip should use Popover API to avoid z-index issues #2124

Closed
@dgreif

Description

@dgreif

Describe the bug
The Tooltip component currently uses a ::before pseudo-element to render its content, with a z-index of 1000001. While this works in a lot of scenarios, it does not match the Portal approach used by many of the other Overlays in PRC. In particular, tooltips can get covered up when their ancestor has created a new stacking context (with something like z-index: 0). It can also be a problem if the parent is clipped or has overflow: hidden.

Rather than relying on ancestors to be styled correctly, we should put the Tooltip in a Portal. This way it will always be rendered with a z-index: 1 at the page stacking context.

To Reproduce
See https://codesandbox.io/s/magical-tesla-4pdhth?file=/src/App.js

Expected behavior
Tooltip should always show up above anything with z-index: 1

I'm not sure if anchoredPosition has a 1-to-1 matching with the direction option, so we may need to add more options there, or else this will probably be a breaking change. likely a breaking change anyways given the Portal z-index is 1 at the page level.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions