HTMLFormFieldWithButton: Don't pass empty string as 'id'
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 30 Apr 2019 00:10:16 +0000 (02:10 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 30 Apr 2019 00:10:16 +0000 (02:10 +0200)
The button must have an ID to be able to be infused. If the given ID
is null, that's fine, OOUI will generate one. But passing an empty
string apparently disables that.

Bug: T222013
Change-Id: I96e1f838385c5539ed246d2ee7107cd037a5f338

includes/htmlform/fields/HTMLFormFieldWithButton.php

index 93f5363..be8f7d8 100644 (file)
@@ -59,7 +59,7 @@ class HTMLFormFieldWithButton extends HTMLFormField {
                        'type' => $this->mButtonType,
                        'label' => $this->mButtonValue,
                        'flags' => $this->mButtonFlags,
-                       'id' => $this->mButtonId,
+                       'id' => $this->mButtonId ?: null,
                ] + OOUI\Element::configFromHtmlAttributes(
                        $this->getAttributes( [ 'disabled', 'tabindex' ] )
                ) );