diff --git a/common/changes/office-ui-fabric-react/add-shift-into-delete-action_2018-11-30-21-46.json b/common/changes/office-ui-fabric-react/add-shift-into-delete-action_2018-11-30-21-46.json new file mode 100644 index 0000000000000..e3de7e445c4b2 --- /dev/null +++ b/common/changes/office-ui-fabric-react/add-shift-into-delete-action_2018-11-30-21-46.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "Picker: The shift key is now required (in addition to the del key) in order to delete a suggestion.", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "xiameng@microsoft.com" +} diff --git a/packages/office-ui-fabric-react/src/components/FloatingPicker/BaseFloatingPicker.tsx b/packages/office-ui-fabric-react/src/components/FloatingPicker/BaseFloatingPicker.tsx index 75f4f8e9bba3a..4e4677dd1a4d8 100644 --- a/packages/office-ui-fabric-react/src/components/FloatingPicker/BaseFloatingPicker.tsx +++ b/packages/office-ui-fabric-react/src/components/FloatingPicker/BaseFloatingPicker.tsx @@ -266,14 +266,15 @@ export class BaseFloatingPicker> extend this.props.onRemoveSuggestion && this.suggestionsControl && this.suggestionsControl.hasSuggestionSelected && - this.suggestionsControl.currentSuggestion + this.suggestionsControl.currentSuggestion && + ev.shiftKey ) { (this.props.onRemoveSuggestion as ((item: T) => void))(this.suggestionsControl.currentSuggestion!.item); this.suggestionsControl.removeSuggestion(); this.forceUpdate(); + ev.stopPropagation(); } - ev.stopPropagation(); break; case KeyCodes.up: diff --git a/packages/office-ui-fabric-react/src/components/FloatingPicker/Suggestions/SuggestionsCore.tsx b/packages/office-ui-fabric-react/src/components/FloatingPicker/Suggestions/SuggestionsCore.tsx index d6f7df41aff96..55b42efb48ee0 100644 --- a/packages/office-ui-fabric-react/src/components/FloatingPicker/Suggestions/SuggestionsCore.tsx +++ b/packages/office-ui-fabric-react/src/components/FloatingPicker/Suggestions/SuggestionsCore.tsx @@ -103,7 +103,7 @@ export class SuggestionsCore extends BaseComponent, this.currentSuggestion = suggestions[0]; this.currentSuggestion.selected = true; } else { - if (this.currentIndex > -1) { + if (this.currentIndex > -1 && suggestions[this.currentIndex]) { suggestions[this.currentIndex].selected = false; } suggestions[index].selected = true;