Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If two modal boxes are opened in order, clicking on the mask layer will cause both modal boxes to be closed simultaneously #1204

Closed
mcpanl opened this issue Jan 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@mcpanl
Copy link

mcpanl commented Jan 5, 2024

Environment

  • Operating System: Windows_NT
  • Node Version: v18.12.1
  • Nuxt Version: 3.9.0
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: yarn@1.22.19
  • Builder: -
  • User Config: ssr, app, devtools, build, vite, experimental, modules, i18n, typescript, runtimeConfig, devServer, routeRules
  • Runtime Modules: @nuxt/ui@2.10.0, @nuxtjs/i18n@8.0.0, @nuxtjs/color-mode@3.3.2, @nuxt/image@1.1.0
  • Build Modules: -

Version

v3.9.0

Reproduction

https://stackblitz.com/edit/nuxt-ui-7tatth?file=app.vue

Description

Without setting prevent close, if Modal Box 1 and Modal Box 2 are opened in order, clicking on the mask layer will cause both dialog boxes to be closed simultaneously. The correct logic should be to close Modal Box 2 the first time the mask layer is clicked, and Modal Box 1 will only be closed the second time the mask layer is clicked

Additional context

No response

Logs

No response

@mcpanl mcpanl added the bug Something isn't working label Jan 5, 2024
Copy link
Member

This won't work unfortunately due to a limitation of Headless UI. You have to either nest your modals or close the first modal and open the second one in a timeout equal of the delay of the first modal. Some references:

@alexcroox
Copy link

Will the switch away from Headless UI resolve this in v3?

Copy link
Member

It already does 😊
https://volta.s3.fr-par.scw.cloud/Clean_Shot_2024_05_20_at_10_56_12_26efab2079.mp4

@alexcroox
Copy link

Amazing thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants