1
votes

I'm using the following component:

https://material-ui.com/components/popper/

In the DOM, it has the role of tooltip. I expect that it would automatically get the tooltip zIndex from the theme here:

https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/styles/zIndex.js

But it gets no z-index. What gives?

1

1 Answers

1
votes

Seems like you're using a component that is too low-level. The zIndex.tooltip you've mentioned is being used in the Tooltip component. So you have two options:

  1. Switch your code to be using Tooltip directly and don't worry about applying zIndexes around
  2. Keep your Popper implementation apply the zIndex manually. Or use withStyles, just like the Tooltip component does.

For a greater flexibility and control over how stuff gets done, I would prefer the second approach, to be fair.