Skip to content

fix(compiler-vapor): avoid delegating same-event handlers when sibling uses stop modifiers#14610

Merged
edison1105 merged 2 commits intominorfrom
edison/fix/14609
Mar 23, 2026
Merged

fix(compiler-vapor): avoid delegating same-event handlers when sibling uses stop modifiers#14610
edison1105 merged 2 commits intominorfrom
edison/fix/14609

Conversation

@edison1105
Copy link
Copy Markdown
Member

@edison1105 edison1105 commented Mar 21, 2026

close #14609

Summary by CodeRabbit

  • Bug Fixes
    • Improved event delegation behavior for v-on handlers with multiple events and stop modifiers
    • Fixed event normalization for click modifiers (.right, .middle) to correctly map to underlying event types
    • Enhanced compilation of event handlers to prevent incorrect delegation in complex modifier combinations

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 21, 2026

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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.
Linked Issues check ✅ Passed The PR implements the fix for issue #14609 by preventing event delegation when .stop modifiers are involved, ensuring stopPropagation works correctly in Vapor.
Out of Scope Changes check ✅ Passed All changes are focused on fixing event delegation behavior for .stop modifiers in the Vapor compiler, directly addressing the linked issue.
Title check ✅ Passed The title accurately describes the main change: preventing event delegation for handlers sharing the same event when .stop modifiers are involved, which directly addresses the issue and aligns with the code changes.

✏️ 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/14609

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 21, 2026

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: f617bea

@github-actions
Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 86.4 kB 30.2 kB 26.6 kB
runtime-dom.global.prod.js 111 kB 41.9 kB 37.5 kB
vue.global.prod.js 170 kB 61.7 kB 55 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 50.6 kB 19.8 kB 18 kB
createApp 59.6 kB 23.1 kB 21 kB
createApp + vaporInteropPlugin 85 kB 31.4 kB 28.4 kB
createVaporApp 28.7 kB 11.1 kB 10.2 kB
createSSRApp 63.9 kB 24.8 kB 22.5 kB
createVaporSSRApp 31.9 kB 12.3 kB 11.3 kB
defineCustomElement 66.2 kB 25.1 kB 22.8 kB
defineVaporCustomElement 39.3 kB 14.5 kB 13.3 kB
overall 74.5 kB 28.4 kB 25.8 kB

@edison1105 edison1105 linked an issue Mar 21, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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/compiler-vapor/src/transforms/vOn.ts`:
- Around line 93-97: The current delegated decision (variable delegate computed
from arg.isStatic && !eventOptionModifiers.length &&
!nonKeyModifiers.includes('stop') && delegatedEvents(arg.content)) must be made
per-event-name across the element instead of per-handler: compute a map for the
element that marks each static event name as "delegationDisabled" if any handler
for that event contains the 'stop' modifier (or other modifiers that should
disable delegation), then replace the per-handler check
(!nonKeyModifiers.includes('stop')) with a lookup against that per-event flag
when computing delegate; locate the delegate computation inside the vOn
transform (symbols: delegate, arg, eventOptionModifiers, nonKeyModifiers,
delegatedEvents) and update it to consult the event-level map so that if any
sibling handler for the same static event has .stop, delegation is disabled for
all handlers of that event.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 80fda4bb-d825-4d05-9f97-87bedb544936

📥 Commits

Reviewing files that changed from the base of the PR and between 5fb8b33 and ed22374.

⛔ Files ignored due to path filters (1)
  • packages/compiler-vapor/__tests__/transforms/__snapshots__/vOn.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • packages/compiler-vapor/__tests__/transforms/vOn.spec.ts
  • packages/compiler-vapor/src/transforms/vOn.ts

@edison1105 edison1105 marked this pull request as ready for review March 23, 2026 01:17
@edison1105 edison1105 added the scope: vapor related to vapor mode label Mar 23, 2026
@edison1105 edison1105 changed the title fix(compiler-vapor): disable event delegation for .stop modifiers fix(compiler-vapor): avoid delegating same-event handlers when sibling uses stop modifiers Mar 23, 2026
@edison1105 edison1105 merged commit bf7a066 into minor Mar 23, 2026
16 of 17 checks passed
@edison1105 edison1105 deleted the edison/fix/14609 branch March 23, 2026 01:21
zhiyuanzmj added a commit to vuejs/vue-jsx-vapor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Vapor] Click event modifiers not working as expected

1 participant