question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I am currently using the modals provided by react semantic ui. There is a prop for a modal which makes the blurred. (https://react.semantic-ui.com/modules/modal/).

When I use it, my toasts won’t appear, they are “behind” the blurred content. Is there a way to set the z index on the toasts or make them available up front?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
timolinscommented, Jul 31, 2021

Yes, you can change the z-index, for both the container or the toasts.

<Toaster
  containerStyle={{
	 zIndex: 9999 // For the container
  }}
  toastOptions={{
    style: {
      zIndex: 9999 // For toasts
    },
  }}
/>
1reaction
joriswcommented, Nov 29, 2021

However toast.custom()'s second parameter does not accept a containerStyle property:

image

The styles that I apply myself to the top-level DOM node that my <Notification /> component produces, does not help, as the container produced one level above, by react-hot-toast, sets a z-index: 9999, which I can’t seem to override.

Even this doesn’t work for me:

    toast.custom(<div style={{ zIndex: 20000, backgroundColor: 'red' }} />)

… The top level container of react-hot-toast keeps z-index: 9999.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using z-index - CSS: Cascading Style Sheets - MDN Web Docs
Using z-index · When no z-index property is specified, elements are rendered on the default rendering layer (Layer 0). · If several elements...
Read more >
CSS z-index property - W3Schools
The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element...
Read more >
z-index - CSS-Tricks
The z-index property in CSS controls the vertical stacking order of elements that overlap. As in, which one appears as if it is...
Read more >
Understanding Z-Index in CSS - Ahmad Shadeed
The z-index property defines the order of the elements on the z-axis. Basically, it works on elements with a position value other than...
Read more >
Z-index and stacking contexts - web.dev
The z-index property explicitly sets a layer order for HTML based on the 3D space of the browser—the Z axis. This is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found