jenkins-bot has submitted this change and it was merged.

Change subject: TextInputWidget: Show state as valid (no matter the case) on 
focus
......................................................................


TextInputWidget: Show state as valid (no matter the case) on focus

Bug: T134030
Change-Id: I107d5daa7085bf7e95e1f649f8a9c9dcbb6338ed
---
M src/widgets/TextInputWidget.js
1 file changed, 23 insertions(+), 2 deletions(-)

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



diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index 247358e..2c51ac2 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -108,7 +108,8 @@
        // Events
        this.$input.on( {
                keypress: this.onKeyPress.bind( this ),
-               blur: this.onBlur.bind( this )
+               blur: this.onBlur.bind( this ),
+               focus: this.onFocus.bind( this )
        } );
        this.$input.one( {
                focus: this.onElementAttach.bind( this )
@@ -120,6 +121,7 @@
                change: 'onChange',
                disable: 'onDisable'
        } );
+       this.on( 'change', OO.ui.debounce( this.onDebouncedChange.bind( this ), 
300 ) );
 
        // Initialization
        this.$element
@@ -263,6 +265,16 @@
 };
 
 /**
+ * Handle focus events.
+ *
+ * @private
+ * @param {jQuery.Event} e Focus event
+ */
+OO.ui.TextInputWidget.prototype.onFocus = function () {
+       this.setValidityFlag( true );
+};
+
+/**
  * Handle element attach events.
  *
  * @private
@@ -283,11 +295,20 @@
  */
 OO.ui.TextInputWidget.prototype.onChange = function () {
        this.updateSearchIndicator();
-       this.setValidityFlag();
        this.adjustSize();
 };
 
 /**
+ * Handle debounced change events.
+ *
+ * @param {string} value
+ * @private
+ */
+OO.ui.TextInputWidget.prototype.onDebouncedChange = function () {
+       this.setValidityFlag();
+};
+
+/**
  * Handle disable events.
  *
  * @param {boolean} disabled Element is disabled

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I107d5daa7085bf7e95e1f649f8a9c9dcbb6338ed
Gerrit-PatchSet: 3
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: Prtksxna <[email protected]>
Gerrit-Reviewer: VolkerE <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to