HTMLTextField: Pass extra parameters in OOUI mode
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 12 Sep 2018 20:09:47 +0000 (22:09 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 12 Sep 2018 20:15:48 +0000 (22:15 +0200)
Some additional parameters that are passed through as attributes in
HTML mode were not being passed through as config options in OOUI mode:
* 'min'
* 'max'
* 'step'
* 'title'

Some have no equivalent in OOUI:
* 'pattern'
* 'list'
* 'multiple'

Also note that we support some OOUI config options that have no
equivalent in HTML:
* 'autosize'
* 'flags'
* 'indicator'

I originally noticed the problem with the 'min' and 'max' params,
which are clearly missing in OOUI preferences for RC and watchlist.
I don't know if anything anywhere actually uses the other ones.

Bug: T181844
Change-Id: I2d22ef3b08b7f0b4283b644d80bd74906177d089

includes/htmlform/fields/HTMLTextField.php

index d988c29..60c63d6 100644 (file)
@@ -85,18 +85,19 @@ class HTMLTextField extends HTMLFormField {
                        'type',
                        'min',
                        'max',
-                       'pattern',
-                       'title',
                        'step',
-                       'list',
+                       'title',
                        'maxlength',
                        'tabindex',
                        'disabled',
                        'required',
                        'autofocus',
-                       'multiple',
                        'readonly',
                        'autocomplete',
+                       // Only used in HTML mode:
+                       'pattern',
+                       'list',
+                       'multiple',
                ];
 
                $attribs += $this->getAttributes( $allowedParams );
@@ -153,17 +154,22 @@ class HTMLTextField extends HTMLFormField {
                # @todo Enforce pattern, step, required, readonly on the server side as
                # well
                $allowedParams = [
+                       'type',
+                       'min',
+                       'max',
+                       'step',
+                       'title',
+                       'maxlength',
+                       'tabindex',
+                       'disabled',
+                       'required',
                        'autofocus',
+                       'readonly',
+                       'autocomplete',
+                       // Only used in OOUI mode:
                        'autosize',
-                       'disabled',
                        'flags',
                        'indicator',
-                       'maxlength',
-                       'readonly',
-                       'required',
-                       'tabindex',
-                       'type',
-                       'autocomplete',
                ];
 
                $attribs += OOUI\Element::configFromHtmlAttributes(