Skip to content

Bug: setValue() on input[type=checkbox] does not fire input event. #2014

Closed
@ascott18

Description

@ascott18

Describe the bug
Per specs (https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event), input is fired in addition to change for checkboxes/radios:

For elements with type=checkbox or type=radio, the input event should fire whenever a user toggles the control, per the HTML Living Standard specification. However, historically this has not always been the case. Check compatibility, or use the change event instead for elements of these types.

To Reproduce
https://stackblitz.com/edit/vitest-dev-vitest-21mzeo?file=components%2FHello.vue,test%2Fbasic.test.ts&initialPath=__vitest__

Expected behavior
setValue fires the input event

Related information:
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 6.24 GB / 31.94 GB
npmPackages:
@vue/test-utils: ^2.3.2 => 2.3.2
vitest: 0.28.5 => 0.28.5
vue: ^3.2.45 => 3.2.45

Additional context
Vuetify, among probably other libraries, uses input instead of change. https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VSelectionControl/VSelectionControl.tsx#L241

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions