See also MassMessage ApiQueryMMSites api module and ext.MassMessage.autocomplete.js javascript
Description
Related Objects
- Mentioned In
- T296133: Add a way to select all sites in site list
T260860: Performance review of GlobalWatchlist - Mentioned Here
- T154027: HTMLComboboxField does not provide autocomplete in ooui format
T268210: User-defined project domains should be validated
T260860: Performance review of GlobalWatchlist
Event Timeline
Note that this would also need to take into account T268210: User-defined project domains should be validated - only valid sites should be shown
Okay, so some initial notes:
MassMessage uses jQuery autocomplete by loading jquery.ui, which does work with OOUI text inputs, but doesn't look great. If we use that
- https://api.jqueryui.com/autocomplete/ is a good reference
- the site inputs that we need to select: var $sites = $('input[name^="wpsites"]')
- somehow, options are provided to the front end (perhaps use addJsConfigVars with the valid sites)
var $sites = $('input[name^="wpsites"]') $sites.autocomplete( { source: [ 'abcde', 'abcdz', 'abcdy' ] } );
where the source array is actually whatever the valid options are
needs to be updated each time a new row is created (infuse the create button and add a listener?)
There is a separate autocomplete system for html forms, at mediawiki.htmlform/autocomplete.js. If we use that
- use the autocompleteselect type, for HTMLAutoCompleteSelectField
but, that is documented as "HTMLComboboxField implements most of the same functionality and should be used instead, if possible."
or, HTMLComboboxField and combobox type can be used, with options to set the valid options for autocomplete
combobox is used for some existing deployed special pages (Special:PagesWithProp, Special:MIMESearch, wikibase Special:ItemByTitle) but testing them out shows that it doesn't appear that the autocomplete is working properly with OOUI (T154027: HTMLComboboxField does not provide autocomplete in ooui format)
For now, it looks like the best option is using autocompleteselect/HTMLAutoCompleteSelectField, which is already used for SecurePoll and appears to work fine.
$validSites = $this->maybeGetValidSites() ?? []; $validSites = array_combine( $validSites, $validSites ); $siteFields = [ 'site' => [ 'type' => 'autocompleteselect', 'autocomplete-data': $validSites, ], ...
(Moving to later, waiting until my patch for T154027 is merged to allow using HTMLComboboxField which does exactly this and is preferred over HTMLAutoCompleteSelectField)