From 7752f64f80978028aacfd92cda5dfc87bd8fa6f1 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 27 May 2026 12:42:37 +0200 Subject: [PATCH 1/9] feat(Dialog): support unmountOnHide When set to false, Dialog content and overlay stay in the DOM when closed (hidden via v-show) instead of being unmounted. Useful for SEO and performance by avoiding remounts on every open. Closes #1727 --- docs/content/meta/DialogRoot.md | 8 ++++++++ packages/core/src/Dialog/DialogContent.vue | 9 ++++++++- packages/core/src/Dialog/DialogContentImpl.vue | 2 +- packages/core/src/Dialog/DialogContentModal.vue | 16 ++++++++++++---- packages/core/src/Dialog/DialogOverlay.vue | 4 ++++ packages/core/src/Dialog/DialogOverlayImpl.vue | 9 +++++++-- packages/core/src/Dialog/DialogRoot.vue | 11 ++++++++++- 7 files changed, 50 insertions(+), 9 deletions(-) diff --git a/docs/content/meta/DialogRoot.md b/docs/content/meta/DialogRoot.md index 89d3dc34ad..efbd13721e 100644 --- a/docs/content/meta/DialogRoot.md +++ b/docs/content/meta/DialogRoot.md @@ -21,6 +21,13 @@ 'description': '

The controlled open state of the dialog. Can be binded as v-model:open.

\n', 'type': 'boolean', 'required': false + }, + { + 'name': 'unmountOnHide', + 'description': '

When set to false, the dialog content will not be unmounted when closed, but instead hidden with CSS. Useful for SEO or when you want to improve performance by not remounting the component on every open.

\n', + 'type': 'boolean', + 'required': false, + 'default': 'true' } ]" /> @@ -55,6 +62,7 @@ | `defaultOpen` | The open state of the dialog when it is initially rendered. Use when you do not need to control its open state. | `boolean` | No | `false` | | `modal` | The modality of the dialog When set to true,
interaction with outside elements will be disabled and only dialog content will be visible to screen readers. | `boolean` | No | `true` | | `open` | The controlled open state of the dialog. Can be binded as v-model:open. | `boolean` | No | - | +| `unmountOnHide` | When set to `false`, the dialog content will not be unmounted when closed, but instead hidden with CSS. Useful for SEO or when you want to improve performance by not remounting the component on every open. | `boolean` | No | `true` | **Events** diff --git a/packages/core/src/Dialog/DialogContent.vue b/packages/core/src/Dialog/DialogContent.vue index 0bbd22b3d4..f97156016a 100644 --- a/packages/core/src/Dialog/DialogContent.vue +++ b/packages/core/src/Dialog/DialogContent.vue @@ -32,16 +32,23 @@ const { forwardRef } = useForwardExpose()