Skip to content

Modal closes unexpectedly on touch after interacting with Toast overlay #5694

@quentingiraud-ugo

Description

@quentingiraud-ugo

Environment

  • Operating System: macOS 25.1.0
  • Node.js Version: v22.19.0
  • Nuxt Version: 4.2.2
  • CLI Version: 3.31.2
  • Nitro Version: 2.12.9
  • Package Manager: pnpm 8.14.3
  • Builder: vite 7.2.7
  • Modules: @nuxt/eslint 1.10.0, @nuxt/ui 4.2.1

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

v4.2.1

Reproduction

https://github.com/quentingiraud-ugo/nuxtui-modal-touch-bug

Description

When using touch devices, the UModal component closes unexpectedly after interacting with an external overlay element (like a Toast).

Steps to reproduce

⚠️ This bug only occurs on touch devices (mobile, tablet, or touch-enabled browsers with touch simulation)

  1. Open the modal by tapping the "Open Modal" button
  2. Tap the "Show Toast" button inside the modal → A toast notification appears
  3. Tap the toast to dismiss it (or wait for it to auto-close)
  4. Tap the "Show Toast" button again
  5. Bug: The modal closes unexpectedly

Expected behavior

The modal should remain open when tapping the "Show Toast" button multiple times.

Actual behavior

After dismissing a toast and tapping the button again, the modal closes as if the user tapped outside the modal overlay.

Additional context

This seems related to how touch events are handled when another overlay (Toast) is dismissed. The next touch event after the toast dismissal appears to be interpreted as a click outside the modal.

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions