From 6dfbb940aded2eed2ace73262571fc8330926b20 Mon Sep 17 00:00:00 2001 From: Explicit12 Date: Thu, 9 Jan 2025 06:30:51 +0200 Subject: [PATCH] Fixed input label position after slot changed --- src/ui.form-input/UInput.vue | 6 ++++-- src/ui.form-textarea/UTextarea.vue | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui.form-input/UInput.vue b/src/ui.form-input/UInput.vue index 3d0c1a4e..70d70ba3 100644 --- a/src/ui.form-input/UInput.vue +++ b/src/ui.form-input/UInput.vue @@ -198,8 +198,10 @@ function transformValue(value: string | number, exp: string | RegExp) { return matches ? matches.join("") : ""; } -useMutationObserver(leftSlotWrapperRef, (mutations) => { - mutations.forEach(setLabelPosition); +useMutationObserver(leftSlotWrapperRef, (mutations) => mutations.forEach(setLabelPosition), { + childList: true, + characterData: true, + subtree: true, }); function setLabelPosition() { diff --git a/src/ui.form-textarea/UTextarea.vue b/src/ui.form-textarea/UTextarea.vue index cb063658..71cbc00b 100644 --- a/src/ui.form-textarea/UTextarea.vue +++ b/src/ui.form-textarea/UTextarea.vue @@ -154,8 +154,10 @@ function toggleReadonly(hasReadonly: boolean) { } } -useMutationObserver(leftSlotWrapperRef, (mutations) => { - mutations.forEach(setLabelPosition); +useMutationObserver(leftSlotWrapperRef, (mutations) => mutations.forEach(setLabelPosition), { + childList: true, + characterData: true, + subtree: true, }); function setLabelPosition() {