As part of the on-going UI standardisation work[0], we have just merged
into MediaWiki master a patch that will allow users of HTMLForm[1] to
easily switch over to use OOUI[2]. This allows you to make your code use
the standard UI styling and components with very little effort, improving
consistency and accessibility.
To convert your code over from the existing styling of MediaWiki's HTMLForm
(or its VForm version), you can replace the instantiation command of
- $form = new HTMLForm( … );
- or:
- $form = HTMLForm::factory( 'vform', … );
-
with
- $form = HTMLForm::factory( 'ooui', … );
… and everything Should Just Work™.
This doesn't break anything for existing use of this code, and you can
explicitly retain the existing styling by using $form = HTMLForm::factory(
'table', … ); or 'div' or 'vform' instead if you wish. Feel free
to add
your code to the epic task on Phabricator which is the central liaison
point for this work[3].
Finally, please be careful to check your interfaces after converting them –
although we have tested this and believe it works well, there may be some
edge cases where it doesn't quite work. We're still missing a few features
[4] (such as prettier radio buttons), which we're hoping to have ready in a
week or two. If do you find any such issues, please report them so we can
fix them. Also note that OOUI already implements the new "MediaWiki" theme
for all users, so please ensure you advertise the visual changes as they
roll out to minimise disruption.
[0] -
https://phabricator.wikimedia.org/T49145
[1] -
https://www.mediawiki.org/wiki/HTMLForm
[2] -
https://phabricator.wikimedia.org/T85291
[3] -
https://phabricator.wikimedia.org/T100270
[4] -
https://phabricator.wikimedia.org/T100279
Yours,
--
James D. Forrester
Product Manager, Editing
Wikimedia Foundation, Inc.
jforrester(a)wikimedia.org | @jdforrester