Skip to content

Commit 32d2d16

Browse files
authored
[6.x] Fix Textarea component resize (#13788)
1 parent c20288d commit 32d2d16

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

resources/js/components/ui/Textarea.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ const classes = cva({
4747
const textarea = useTemplateRef('textarea');
4848
4949
onMounted(() => {
50-
autosize(textarea.value);
51-
setTimeout(() => nextTick(() => autosize.update(textarea.value)), 1);
50+
if (props.elastic) {
51+
autosize(textarea.value);
52+
setTimeout(() => nextTick(() => autosize.update(textarea.value)), 1);
53+
}
5254
});
5355
54-
onBeforeUnmount(() => autosize.destroy(textarea.value));
56+
onBeforeUnmount(() => {
57+
if (props.elastic) {
58+
autosize.destroy(textarea.value);
59+
}
60+
});
5561
</script>
5662

5763
<template>

resources/js/stories/Textarea.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ export const _Placeholder: Story = {
108108
};
109109

110110
const resizeCode = `
111+
<Textarea resize="horizontal" rows="1" placeholder="Resize horizontal"/>
111112
<Textarea resize="vertical" rows="1" placeholder="Resize vertical"/>
112113
<Textarea resize="both" rows="1" placeholder="Resize both"/>
113-
<Textarea resize="horizontal" rows="1" placeholder="Resize horizontal"/>
114114
<Textarea resize="none" rows="1" placeholder="Resize none"/>
115115
`;
116116

0 commit comments

Comments
 (0)