Page MenuHomePhabricator

CheckboxMultiselectInputWidget does not fire change event when its CheckboxMultiselectWidget changes
Closed, ResolvedPublic

Description

The documentation says that CheckboxMultiselectInputWidget fires a change event, but when the checkboxes of its CheckboxMultiselectWidget are changed, no change event is emitted. It's not clear to me if that is desired behavior (and why) or a bug.

A workaround is to access the undocumented checkboxMultiselectWidget property.

Example:

// does not work
var mySelection = new OO.ui.CheckboxMultiselectInputWidget( {
   options: [ {data: 'a', label: 'First' }, {data: 'b', label: 'Second'}
} );
mySelection.on( 'change', function ( e ) { console.log( 'mySelection changed', e ); } );

// workaround
var mySelection = new OO.ui.CheckboxMultiselectInputWidget( {
   options: [ {data: 'a', label: 'First' }, {data: 'b', label: 'Second'}
} );
mySelection.checkboxMultiselectWidget.on( 'change', function ( e ) { console.log( 'mySelection changed', e ); } );

Event Timeline

Thanks for the report @gabriel-wmde. The documentation was being (correctly) inherited from OO.ui.InputWidget but we forgot to implement it.

Change 365586 had a related patch set uploaded (by Prtksxna; owner: Prtksxna):
[oojs/ui@master] CheckboxMultiselectInputWidget: Pass on change event

https://gerrit.wikimedia.org/r/365586

Volker_E assigned this task to Prtksxna.
Volker_E triaged this task as Medium priority.
Volker_E moved this task from Reviewing to OOjs-UI-0.22.4 on the OOUI board.
Volker_E edited projects, added OOUI (OOjs-UI-0.22.4); removed OOUI.
Volker_E removed a project: Patch-For-Review.
Volker_E removed a subscriber: gerritbot.

Change 365586 merged by jenkins-bot:
[oojs/ui@master] CheckboxMultiselectInputWidget: setValue when CheckboxMultiselect changes

https://gerrit.wikimedia.org/r/365586

Change 935701 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/AdvancedSearch@master] Remove OOUI workarounds that got fixed upstream

https://gerrit.wikimedia.org/r/935701