Skip to content

[Bug]: toast messages don't work when modal is open #110

@0xFFrancesco

Description

@0xFFrancesco

Prerequisites

  • I have searched existing issues to ensure this bug hasn't been reported already
  • I have tested this with the latest version of the components

Bug description

When a modal is open, notifications (toast messages via Sonner) are not clickable.

Steps to reproduce

Create a page that has both a modal and the Sonner toaster.
Open the modal.
Trigger a notification while the modal is open.
The notification is not interactive.

Expected behavior

Notifications should stay interactive, draggable or clickable.

Actual behavior

They are not interactive.

Code example

Browser

Chrome

Device type

Desktop

Component version

No response

Environment details

MacOS 26
Chrome - latest

Screenshots/Videos

No response

Console errors

Additional context

In detail:

The modal makes all the content under body (not just the React root) as inert

The notifications are also set to be inert (or a descendent of an inert node)

The modal is very aggressive, targeting all items under body, and a Portal to move the notifications in a
different DOM level doesn't help

My workaround was to prevent the notifications container from becoming inert using an Hook to restore the inert attribute with a MutationObserver

But that's 'hacky', and Ideally should work out of the box...

Accessibility impact

  • This bug affects keyboard navigation
  • This bug affects screen reader users
  • This bug affects focus management
  • This bug affects color contrast or visual accessibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions