Skip to content

react-aria-components: Modal reopens after navigation when using RouterProvider with Next.js and Tailwind Typography in production (Chrome only) #8786

@teo-goulois

Description

@teo-goulois

Provide a general summary of the issue here

When using RouterProvider from react-aria-components in a Next.js app, a modal in the shared navbar reopens after navigation if the destination page contains a Tailwind Typography prose element.

This happens even though the modal state is closed in the navbar.
The bug only occurs:

  • in production builds
  • in Chrome
  • when RouterProvider is used

Sometimes in development, or when not using RouterProvider, the issue does not occur.

🤔 Expected Behavior?

After navigation, the modal should stay closed since the navbar state remains false.

😯 Current Behavior

  • On Chrome (production build, mostly), the modal reopens automatically after navigating to a page containing prose styles.
  • The internal state in the navbar remains false.
  • No error messages are shown.

🔗 Online reproduction: https://teo-bug-modal.q1xahd.easypanel.host
📦 Repo reproduction: https://github.com/teo-goulois/bug-modal-with-tailwindcss-typography-and-rac

💁 Possible Solution

Not sure yet — the issue seems related to the interaction between RouterProvider navigation handling and Tailwind Typography’s prose styles in production. It could be causing an unexpected re-render or focus/overlay trigger.

🔦 Context

I’m trying to use a shared navbar modal for navigation in my Next.js app. This bug breaks the UX because the modal immediately reopens after redirecting to some pages, even though I expect it to stay closed.

🖥️ Steps to Reproduce

  1. Clone the repo: bug-modal-with-tailwindcss-typography-and-rac
  2. Run npm run build && npm start
  3. Open the navbar modal and click a navigation link
  4. Navigate to a page containing <div className="prose">...</div>
  5. Observe that the modal reopens automatically

Or test directly with the online reproduction:
👉 https://teo-bug-modal.q1xahd.easypanel.host

Version

"react-aria-components": "^1.10.1"

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

Lumy

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions