Skip to content

Commit

Permalink
add shift into delete action (#7274)
Browse files Browse the repository at this point in the history
* add shift into delete action

* add change file

* Delete yarn.lock

* modify change file

* Update add-shift-into-delete-action_2018-11-30-21-46.json

* add checks for setSeleted in suggestionscore
  • Loading branch information
FrancisMengx authored and joschect committed Dec 3, 2018
1 parent 7afa550 commit 2a7f5b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,15 @@ export class BaseFloatingPicker<T, P extends IBaseFloatingPickerProps<T>> 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class SuggestionsCore<T> extends BaseComponent<ISuggestionsCoreProps<T>,
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;
Expand Down

0 comments on commit 2a7f5b1

Please sign in to comment.