primefaces / primefaces/primereact

Toast: component loses its z-index when using "replace"

Open
#8,403 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Hello, we found an issue where the replace method make the toaster component loose its z-index value when there is a single message being show. When there are no messages or more than 1 it behaves correctly. We can see, inspecting the DOM, the z-index property disappearing from the toast component.

The onExited function is called by the CSS transition component and it clears the z-index:
https://github.com/primefaces/primereact/blob/f2294cc30eb2d13d36a4556159388ea9dde6ecb4/components/lib/toast/Toast.js#L95

Reproducer

https://stackblitz.com/edit/fx59uvcx?file=src%2FApp.jsx

System Information
Browser: Chrome, Firefox
primereact: 10.8.0, 10.9.7
react: 18.3.1
Steps to reproduce the behavior
  1. Click "Show dialog"
  2. Click "Show" once
  3. Click "Replace": the message gets rendered behind the dialog

Note: we get the correct behavior if we click on "Show" multiple times, or clear all messages and use "Replace" once.

Expected behavior

The replacing message is rendered above the dialog.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with components/lib/toast/Toast.js, especially the onExited function identified in the report, then reproduce the single-message replace flow using the linked StackBlitz example. Confirm the toast's z-index remains present when replacing one message while a dialog is open, and run the relevant Toast tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
57/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.