Skip to content

fix(runtime-dom): preserve textarea resize dimensions#14747

Merged
edison1105 merged 4 commits into
mainfrom
edison/fix/14741
Apr 22, 2026
Merged

fix(runtime-dom): preserve textarea resize dimensions#14747
edison1105 merged 4 commits into
mainfrom
edison/fix/14741

Conversation

@edison1105

@edison1105 edison1105 commented Apr 22, 2026

Copy link
Copy Markdown
Member

close #14741

Summary by CodeRabbit

  • Bug Fixes

    • Preserve manually-set textarea width and height when reapplying styles to avoid unexpected resizing.
    • Ensure null/empty style values explicitly clear the corresponding properties.
  • Tests

    • Added test coverage validating textarea style patching and preservation behavior.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ae4849b-b3a8-420f-8a0c-eca1beba0bd6

📥 Commits

Reviewing files that changed from the base of the PR and between cbd655c and 5f46c6f.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/modules/style.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime-dom/src/modules/style.ts

📝 Walkthrough

Walkthrough

Added a test and changed the runtime-dom style patcher: null/undefined style values are cleared explicitly, and textarea-specific logic now skips reapplying width/height when the incoming string equals the previous value to avoid overwriting user-resized dimensions.

Changes

Cohort / File(s) Summary
Test Coverage
packages/runtime-dom/__tests__/patchStyle.spec.ts
New test asserting patchProp(el, 'style', prev, next) preserves textarea-resized width/height when the same style object is reapplied, while other style props (e.g., display) come from the style object.
Style Patching Logic
packages/runtime-dom/src/modules/style.ts
patchStyle now reads value = next[key], clears style keys when value == null, adds shouldPreserveTextareaResizeStyle(...), and skips reapplying textarea width/height when the incoming string equals the previous value (including prev === next cases).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I hopped to nudge a jittery style,
Let textareas grow without denial.
Width and height now stay at play,
While other props still find their way.
A tiny hop, a calmer day ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(runtime-dom): preserve textarea resize dimensions' accurately describes the main change: preventing Vue style updates from removing/overwriting native textarea resize styles.
Linked Issues check ✅ Passed The PR addresses the core requirement from #14741: preventing Vue updates from removing unchanged object styles to preserve native textarea resize dimensions and avoid flicker.
Out of Scope Changes check ✅ Passed All changes are scoped to the textarea resize style preservation issue: test additions and implementation logic in style.ts are directly related to #14741 with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edison/fix/14741

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 106 kB (+144 B) 39.9 kB (+63 B) 35.8 kB (+15 B)
vue.global.prod.js 164 kB (+144 B) 59.9 kB (+66 B) 53.3 kB (+98 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.5 kB (+144 B) 18.9 kB (+77 B) 17.3 kB (+70 B)
createApp 56.6 kB (+144 B) 21.9 kB (+76 B) 20 kB (+63 B)
createSSRApp 60.9 kB (+144 B) 23.7 kB (+76 B) 21.6 kB (+61 B)
defineCustomElement 62.8 kB (+144 B) 23.8 kB (+79 B) 21.7 kB (+70 B)
overall 71.2 kB (+144 B) 27.2 kB (+71 B) 24.8 kB (+93 B)

@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14747
npm i https://pkg.pr.new/@vue/compiler-core@14747
yarn add https://pkg.pr.new/@vue/compiler-core@14747.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14747
npm i https://pkg.pr.new/@vue/compiler-dom@14747
yarn add https://pkg.pr.new/@vue/compiler-dom@14747.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14747
npm i https://pkg.pr.new/@vue/compiler-sfc@14747
yarn add https://pkg.pr.new/@vue/compiler-sfc@14747.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14747
npm i https://pkg.pr.new/@vue/compiler-ssr@14747
yarn add https://pkg.pr.new/@vue/compiler-ssr@14747.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14747
npm i https://pkg.pr.new/@vue/reactivity@14747
yarn add https://pkg.pr.new/@vue/reactivity@14747.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14747
npm i https://pkg.pr.new/@vue/runtime-core@14747
yarn add https://pkg.pr.new/@vue/runtime-core@14747.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14747
npm i https://pkg.pr.new/@vue/runtime-dom@14747
yarn add https://pkg.pr.new/@vue/runtime-dom@14747.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14747
npm i https://pkg.pr.new/@vue/server-renderer@14747
yarn add https://pkg.pr.new/@vue/server-renderer@14747.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14747
npm i https://pkg.pr.new/@vue/shared@14747
yarn add https://pkg.pr.new/@vue/shared@14747.tgz

vue

pnpm add https://pkg.pr.new/vue@14747
npm i https://pkg.pr.new/vue@14747
yarn add https://pkg.pr.new/vue@14747.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14747
npm i https://pkg.pr.new/@vue/compat@14747
yarn add https://pkg.pr.new/@vue/compat@14747.tgz

commit: 5f46c6f

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/runtime-dom/__tests__/patchStyle.spec.ts (1)

45-76: Add a display + v-show regression case.

The new object-style coverage is solid, but it still doesn't pin the display bypass in patchStyle() when vShowOriginalDisplay is present. A small unchanged-style case around { display: 'block' } would keep that branch from regressing silently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/runtime-dom/__tests__/patchStyle.spec.ts` around lines 45 - 76, Add
a test in patchStyle.spec.ts that covers the v-show/display bypass: create an
element, set its style.display (e.g., 'block') and set the v-show marker
(vShowOriginalDisplay, typically el._vod) to simulate v-show state, then call
patchProp(el, 'style', null, { display: 'block' }) followed by patchProp(el,
'style', value, value) where the object is unchanged; assert that the element's
display is not overwritten (respects the v-show bypass). This targets the
patchStyle/patchProp behavior when vShowOriginalDisplay is present to prevent
regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/runtime-dom/__tests__/patchStyle.spec.ts`:
- Around line 45-76: Add a test in patchStyle.spec.ts that covers the
v-show/display bypass: create an element, set its style.display (e.g., 'block')
and set the v-show marker (vShowOriginalDisplay, typically el._vod) to simulate
v-show state, then call patchProp(el, 'style', null, { display: 'block' })
followed by patchProp(el, 'style', value, value) where the object is unchanged;
assert that the element's display is not overwritten (respects the v-show
bypass). This targets the patchStyle/patchProp behavior when
vShowOriginalDisplay is present to prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ab1078d8-2d8a-410b-a4dd-c062aae14cbf

📥 Commits

Reviewing files that changed from the base of the PR and between 7df0edd and 7c43a49.

📒 Files selected for processing (2)
  • packages/runtime-dom/__tests__/patchStyle.spec.ts
  • packages/runtime-dom/src/modules/style.ts

@edison1105 edison1105 added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. labels Apr 22, 2026
@edison1105 edison1105 changed the title fix(runtime-dom): avoid reapplying unchanged object styles fix(runtime-dom): preserve textarea resize dimensions Apr 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/runtime-dom/src/modules/style.ts`:
- Around line 50-65: The current check `if (value != null)` skips null/undefined
style entries and lets stale inline styles persist; update the logic in the loop
in modules/style.ts so that when `value` is nullish you explicitly clear the
inline style (e.g. call `setStyle(style, key, '')` or otherwise remove the
style) and still update `nextCache[key]` (recording the cleared state) instead
of making it a no-op—keep the existing conditional call to
`shouldPreserveTextareaResizeStyle(el, key, cachedStyle && cachedStyle[key],
value)` but ensure nullish values go through the removal path; reference `next`,
`key`, `value`, `nextCache`, `cachedStyle`, `setStyle`, and
`shouldPreserveTextareaResizeStyle` to locate where to change the behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99c0afc0-58fa-472f-b448-c6bf17344f92

📥 Commits

Reviewing files that changed from the base of the PR and between 84b49b9 and b00d102.

📒 Files selected for processing (2)
  • packages/runtime-dom/__tests__/patchStyle.spec.ts
  • packages/runtime-dom/src/modules/style.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/runtime-dom/tests/patchStyle.spec.ts

Comment thread packages/runtime-dom/src/modules/style.ts
@vuejs vuejs deleted a comment from edison1105 Apr 22, 2026
@edison1105

Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@vue-bot

vue-bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

📝 Ran ecosystem CI: Open

suite result latest scheduled
pinia success success
quasar success success
primevue success success
radix-vue success success
language-tools success success
nuxt success success
vitepress success success
vant success success
vite-plugin-vue success success
vuetify success success
test-utils success success
router success success
vue-macros success success
vue-simple-compiler success success
vue-i18n success success
vueuse success success

@vuejs vuejs deleted a comment from edison1105 Apr 22, 2026
@edison1105 edison1105 merged commit 11fb2fd into main Apr 22, 2026
16 checks passed
@edison1105 edison1105 deleted the edison/fix/14741 branch April 22, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Textarea resize styles are lost after updates

2 participants