primefaces / primefaces/primereact
Toast: component loses its z-index when using "replace"
Nobody has claimed this yet.
- 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
- Click "Show dialog"
- Click "Show" once
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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