defineModel on Firefox does not work as expected Vue version 3.5.17 Link to minimal…
- User
defineModel on Firefox does not work as expected
Vue version
3.5.17
Link to minimal reproduction
Steps to reproduce
- Use firefox
- Enter anything in the field. It should be blocked and only show "a", but it wont on firefox.
What is expected?
It should only keep "a" and nothing else should "make it through"
What is actually happening?
Seems like either a race condition or firefox not updating at the same time as Chrome? no clue.
System Info
shellSystem: OS: Windows 11 10.0.26100 CPU: (20) x64 Intel(R) Core(TM) i5-14600K Memory: 12.60 GB / 31.77 GB Binaries: Node: 22.16.0 - C:\nvm4w\nodejs\node.EXE npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD Browsers: Edge: Chromium (134.0.3124.85) Internet Explorer: 11.0.26100.1882 -- Its not showing my actual browser: Firefox 139.0.4Any additional comments?
No response
Interface
No new interfaces are introduced.
- Assistant
Let me decode the reproduction link to understand the exact scenario.
- Assistant
Now let me check the order of directive hooks vs props patching in
mountElement: - Assistant
Let me look at the events module, since the repro involves multiple listeners on the same event:
- Assistant
Let me write a failing regression test replicating the repro:
- Assistant
All checks pass. Final verification:
- Assistant
The fix is complete. Summary:
Root cause
The repro binds
defineModel()to<input v-model="model" @input="onInput">whereonInputforcesmodel.value = 'a', and the parent binds the model to a ref. On a keystroke (steady state'a', user types →el.value = "ab"):- The v-model input listener (attached first, since directive hooks run before props are patched) sets → emits → parent ref becomes .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.