200085: Fix for sharing dialog, clear on blur
[arvados-workbench2.git] / src / views-components / sharing-dialog / participant-select.tsx
index 02cdeaf2c28e814a3a1d72d24d8cfadfe143eee3..b43940f045e9f69b87b2dbb515826506e23c0a84 100644 (file)
@@ -88,7 +88,7 @@ export const ParticipantSelect = connect()(
                     onSelect={this.handleSelect}
                     onDelete={this.props.onDelete && !this.props.disabled ? this.handleDelete : undefined}
                     onFocus={this.props.onFocus}
-                    onBlur={this.props.onBlur}
+                    onBlur={this.onBlur}
                     renderChipValue={this.renderChipValue}
                     renderChipTooltip={this.renderChipTooltip}
                     renderSuggestion={this.renderSuggestion}
@@ -96,6 +96,13 @@ export const ParticipantSelect = connect()(
             );
         }
 
+        onBlur = (e) => {
+            if (this.props.onBlur) {
+                this.props.onBlur(e);
+            }
+            setTimeout(() => this.setState({ value: '', suggestions: [] }), 200);
+        }
+
         renderChipValue(chipValue: Participant) {
             const { name, uuid } = chipValue;
             return name || uuid;