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
I’ll trace
defineModel’s generated update path and the input/v-model runtime behavior, then add a focused regression test and verify the relevant suites. - Assistant
rgisn’t installed in this checkout, so I’m switching tofind/grep. I’ll first establish the repository guidance and current worktree state before editing. - Assistant
The reproduction isolates the problem to listener ordering: native
v-modeland the user’s@inputhandler both consume the same DOM event. Vue currently installs the model listener through the directive hook and the user listener through prop patching, whose relative order differs in Firefox. I’m checking the renderer’s mount order and existing directive tests to make the ordering deterministic without changing the public API. - Assistant
I’ve narrowed the fix to native
v-model, not thedefineModelmacro itself. I’m making model synchronization run in the capture phase so it deterministically precedes ordinary@input/@changehandlers, then adding a regression that reverses listener registration order to model Firefox’s observed behavior. - Assistant
The first test command selected the generic unit project, which intentionally excludes runtime-dom tests. The code formatted cleanly; I’m rerunning against the DOM-specific project and will then run type checking/lint on the touched files.
- Assistant
The regression now passes, and both lint and the repository TypeScript check are clean. I’m doing one broader runtime-dom test pass to catch any event-phase side effects, especially around composition, modifiers, checkbox/radio, and lazy models.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.