Skip to content

Conversation

@Rizwan-malek
Copy link
Contributor

@Rizwan-malek Rizwan-malek commented Mar 18, 2025

Hi team,

I encountered an issue where $emit('closed') or emit('closed') was not working. However, when I used only close, it worked as expected.

Could you please help clarify this behaviour?

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Hi,

I have faced the $emit('closed') or emit('closed') not working, I just check with the close word only, It will work

Thanks
@benjamincanac
Copy link
Member

@genu Does this seem correct to you?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 18, 2025

npm i https://pkg.pr.new/@nuxt/ui@3601

commit: 9ff8d7c

@Rizwan-malek Rizwan-malek changed the title Fixed modal close event name issues chore(readme): fixed modal close event name issues Mar 18, 2025
@Rizwan-malek Rizwan-malek changed the title chore(readme): fixed modal close event name issues chore(readme): fix the issue with the modal close event name Mar 18, 2025
Some important differences:
- The `useOverlay` composable is now used to create overlay instances
- Overlays that are opened, can be awaited for their result
- Overlays can no longer be closed using `modal.close()` or `slideover.close()`, rather, they close automatically: either when a `closed` event is fired explicitly from the opened component OR when the overlay closes itself (clicking on backdrop, pressing the ESC key, etc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlays can no longer be closed using...

This is correct

... either when a closed event is fired explicitly...

You're right, this should be close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,

Thank you @genu

</script>
```

Closing a modal is now done through the `closed` event. The `modal.open` method now returns a promise that resolves to the result of the modal whenever the modal is closed:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whenever the modal is closed

This is correct, lets keep this.

now done through the closed event

You're right here, should be close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @genu

@benjamincanac benjamincanac changed the title chore(readme): fix the issue with the modal close event name docs(migration): improve useOverlay section Mar 18, 2025
@benjamincanac benjamincanac merged commit c8ca604 into nuxt:v3 Mar 18, 2025
2 checks passed
@benjamincanac
Copy link
Member

Thanks!

@benjamincanac benjamincanac added the v3 #1289 label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants