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

Change subject: MenuTagMultiselectWidget: Clear text field after adding an item 
from it
......................................................................


MenuTagMultiselectWidget: Clear text field after adding an item from it

This matches the behavior of the parent class TagMultiselectWidget.

Change-Id: I4319f29bebdfc19266897b544eda8993e3ff89c7
---
M src/widgets/MenuTagMultiselectWidget.js
1 file changed, 9 insertions(+), 3 deletions(-)

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



diff --git a/src/widgets/MenuTagMultiselectWidget.js 
b/src/widgets/MenuTagMultiselectWidget.js
index b3f7bec..acb8121 100644
--- a/src/widgets/MenuTagMultiselectWidget.js
+++ b/src/widgets/MenuTagMultiselectWidget.js
@@ -142,6 +142,7 @@
  */
 OO.ui.MenuTagMultiselectWidget.prototype.addTagFromInput = function () {
        var inputValue = this.input.getValue(),
+               validated = false,
                highlightedItem = this.menu.getHighlightedItem(),
                item = this.menu.getItemFromData( inputValue );
 
@@ -150,14 +151,19 @@
 
        // Look for a highlighted item first
        if ( highlightedItem ) {
-               this.addTag( highlightedItem.getData(), 
highlightedItem.getLabel() );
+               validated = this.addTag( highlightedItem.getData(), 
highlightedItem.getLabel() );
        } else if ( item ) {
                // Look for the element that fits the data
-               this.addTag( item.getData(), item.getLabel() );
+               validated = this.addTag( item.getData(), item.getLabel() );
        } else {
                // Otherwise, add the tag - the method will only add if the
                // tag is valid or if invalid tags are allowed
-               this.addTag( inputValue );
+               validated = this.addTag( inputValue );
+       }
+
+       if ( validated ) {
+               this.clearInput();
+               this.focus();
        }
 };
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4319f29bebdfc19266897b544eda8993e3ff89c7
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to