jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/331096 )

Change subject: TextInputWidget: Disable hiding focus when clicking 
indicator/label
......................................................................


TextInputWidget: Disable hiding focus when clicking indicator/label

Disabling visually stealing focus when clicking indicator or label
of a PHP TextInputWidget's input.

Bug: T154829
Change-Id: Ia7db8f48246843abdd5aec271408129630caa1c0
---
M php/widgets/TextInputWidget.php
M src/styles/widgets/TextInputWidget.less
M tests/JSPHP.test.karma.js
M tests/JSPHP.test.standalone.js
4 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  VolkerE: Looks good to me, approved



diff --git a/php/widgets/TextInputWidget.php b/php/widgets/TextInputWidget.php
index ed0b665..0531256 100644
--- a/php/widgets/TextInputWidget.php
+++ b/php/widgets/TextInputWidget.php
@@ -87,7 +87,11 @@
 
                // Initialization
                $this
-                       ->addClasses( [ 'oo-ui-textInputWidget', 
'oo-ui-textInputWidget-type-' . $this->type ] )
+                       ->addClasses( [
+                               'oo-ui-textInputWidget',
+                               'oo-ui-textInputWidget-type-' . $this->type,
+                               'oo-ui-textInputWidget-php',
+                       ] )
                        ->appendContent( $this->icon, $this->indicator );
                $this->setReadOnly( $config['readOnly'] );
                $this->setRequired( $config['required'] );
diff --git a/src/styles/widgets/TextInputWidget.less 
b/src/styles/widgets/TextInputWidget.less
index 76b3556..37b80ca 100644
--- a/src/styles/widgets/TextInputWidget.less
+++ b/src/styles/widgets/TextInputWidget.less
@@ -101,5 +101,12 @@
                }
        }
 
+       // Make clicks not steal focus from input element in PHP version
+       &-php > .oo-ui-iconElement-icon,
+       &-php > .oo-ui-indicatorElement-indicator,
+       &-php > .oo-ui-labelElement-label {
+               pointer-events: none;
+       }
+
        .theme-oo-ui-textInputWidget();
 }
diff --git a/tests/JSPHP.test.karma.js b/tests/JSPHP.test.karma.js
index eb499fd..7390d2f 100644
--- a/tests/JSPHP.test.karma.js
+++ b/tests/JSPHP.test.karma.js
@@ -28,6 +28,8 @@
 
                                instance = new OO.ui[ test.class ]( config );
                                $fromPhp = $( $.parseHTML( output[ i ] ) );
+                               // HACK: This is the only difference between 
PHP and JS TextInputWidget
+                               $fromPhp.removeClass( 
'oo-ui-textInputWidget-php' );
 
                                $( 'body' ).append( instance.$element, $fromPhp 
);
 
diff --git a/tests/JSPHP.test.standalone.js b/tests/JSPHP.test.standalone.js
index db06971..a40ccd6 100644
--- a/tests/JSPHP.test.standalone.js
+++ b/tests/JSPHP.test.standalone.js
@@ -30,6 +30,8 @@
 
                                id = 'JSPHPTestSuite_' + theme + klassName + i;
                                fromPhp = document.getElementById( id 
).firstChild;
+                               // HACK: This is the only difference between 
PHP and JS TextInputWidget
+                               $( fromPhp ).removeClass( 
'oo-ui-textInputWidget-php' );
                                instance.$element.insertBefore( fromPhp );
 
                                testName = JSON.stringify( test.config );

-- 
To view, visit https://gerrit.wikimedia.org/r/331096
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7db8f48246843abdd5aec271408129630caa1c0
Gerrit-PatchSet: 4
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: VolkerE <volke...@wikimedia.org>
Gerrit-Reviewer: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Prtksxna <psax...@wikimedia.org>
Gerrit-Reviewer: VolkerE <volke...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to