Skip to content

feat(Modal): support unmountOnHide prop#6523

Draft
benjamincanac wants to merge 1 commit into
v4from
feat/modal-unmount-on-hide
Draft

feat(Modal): support unmountOnHide prop#6523
benjamincanac wants to merge 1 commit into
v4from
feat/modal-unmount-on-hide

Conversation

@benjamincanac
Copy link
Copy Markdown
Member

🔗 Linked issue

Depends on unovue/reka-ui#2662 (adds unmountOnHide to DialogRoot).

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds support for the unmountOnHide prop (inherited from DialogRootProps) on Modal and Slideover, and proxies it through ContentSearch and DashboardSearch.

When set to false, the content stays in the DOM while closed (hidden via display: none) instead of being unmounted, which avoids remounting (and recomputing) the content on every open. Useful for heavy content like a CommandPalette inside a search modal. Defaults to true, so existing behavior is unchanged.

  • Modal / Slideover: forward unmountOnHide to DialogRoot and add it to withDefaults so the default shows in the docs API table
  • ContentSearch / DashboardSearch: expose and forward the prop to their inner Modal
  • Docs: "Unmount on Hide" section added to both component pages
  • Tests: cover that content unmounts when closed by default and stays mounted with :unmount-on-hide="false"
  • docs: opt into :unmount-on-hide="false" on the search modal so the command palette isn't rebuilt on every open

Note

This relies on the reka-ui changes from unovue/reka-ui#2662 (plus follow-up DismissableLayer / FocusScope fixes for the force-mount case). The package.json pin currently points at the pkg.pr.new build — it should be bumped to a real release before merge.

📝 Checklist

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

Forward the `unmountOnHide` prop (inherited from `DialogRootProps`) to the
underlying `DialogRoot` in Modal and Slideover, and proxy it through
ContentSearch and DashboardSearch. When set to `false`, the content stays in
the DOM while closed (hidden via `display: none`) instead of being unmounted,
avoiding remounts on every open.

Defaults to `true` to keep the existing behavior.
@github-actions github-actions Bot added the v4 #4488 label May 29, 2026
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtinyglobby@​0.2.16991007784100
Addedpathe@​2.0.31001009282100

View full report

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 29, 2026

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

commit: 2605dff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant