Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

defineModel on Firefox does not work as expected Vue version 3.5.17 Link to minimal…

  1. User

    defineModel on Firefox does not work as expected

    Vue version

    3.5.17

    Link to minimal reproduction

    https://play.vuejs.org/#eNqFUslOwzAQ/RXLlxSppAc4lRaxqIcisQgQJ1+idBJcnLHlJVSq8u+MnbYUynKy573xm+eZWfNLY/I2AB/ziSutNJ458MEwVWA9Fdw7wc8FysZo69maWag6VlndsIxeZTvmWjdmg+ejGETR7EygwFKj86xodEDPplFhkGVHAiejviDJU+ChMarwQBFjkyTXHjd6AYpc9I8FHxE7Ge2l8iE5pAKVrPOl00jfWEcBwUtSkArsvfGSDAg+ZomJXKGUfr9JmLcBhlu8fIXy7Qd86VYRE/zBggPbguA7zhe2BrIW6dnTHazoviPJf1CU/Qf5CE6rED32aVcBF2R7Ly+5nac2S6yf3WzlAd32U9FozOxSvuDU9ti8377+afckP03vBHbUxe3I/tmDfpZpLDTKBVQS4TZGAxqowCpgGWsyjXM0wQ+gBfRjNovHUe9CQRKQlYTFS6ECkFBW0CaxXjdvN+CXJHL5bWMOdkbGintLk07B2UUiCNiYIuhwj7oPe2AHrg

    Steps to reproduce

    1. Use firefox
    2. 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

    System:
        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.4
    

    Any additional comments?

    No response

    Interface

    No new interfaces are introduced.

  2. Assistant

    Investigating defineModel behavior and Firefox-specific v-model handling in the Vue repository.

  3. Assistant

    Implementing capture-phase registration for v-model's input listener so it runs before user @input handlers (Firefox registers listeners in a different order than Chrome).

  4. Assistant

    Cause

    defineModel on a child with parent v-model does not update the local ref synchronously; it only emits and waits for the prop to come back. On <input v-model="model" @input="onInput" /> there are two listeners:

    1. v-model (directive) — native input listener that assigns from el.value
    2. @input — Vue’s invoker (e.g. forcing model.value = 'a')

    If the v-model listener runs after @input, it reads the DOM again and emits the typed value, undoing the handler. Chrome and Firefox differ in listener order, so the bug shows up mainly on Firefox.

    Fix

    Register v-model’s assign listener in the capture phase so it always runs before bubble-phase @input handlers, while user handlers still run last and win.

    // Use capture phase so v-model updates before user onInput handlers.
    // Otherwise browsers may invoke listeners in different orders (e.g. Firefox),
    // causing the v-model listener to overwrite values set in @input handlers.
    const assignListenerOptions: AddEventListenerOptions = { capture: true }
    // ...
        addEventListener(
          el,
          lazy ? 'change' : 'input',
          e => {
            if ((e.target as any).composing) return
            el[assignKey](castValue(el.value, trim, castToNumber))
          },
          assignListenerOptions,
        )
    

    Verification

    • pnpm test-unit runtime-dom — 231 tests passed
    • pnpm test-unit runtime-core (including useModel.spec.ts) — 1019 tests passed
    • git diff --check — clean

    Changes are uncommitted in packages/runtime-dom/src/directives/vModel.ts only.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.