Skip to content

Commit

Permalink
fix(ui5-input): deselect suggestion items on input (#2285)
Browse files Browse the repository at this point in the history
Fixes #2256
  • Loading branch information
fifoosid committed Oct 8, 2020
1 parent d430632 commit a98c6bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ class Input extends UI5Element {
return this._handleEscape(event);
}

if (this.showSuggestions) {
this.Suggestions._deselectItems();
}

this._keyDown = true;
}

Expand Down
7 changes: 7 additions & 0 deletions packages/main/src/features/InputSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ class Suggestions {
}
}

_deselectItems() {
const items = this._getItems();
items.forEach(item => {
item.selected = false;
});
}

_isItemIntoView(item) {
const rectItem = item.getDomRef().getBoundingClientRect();
const rectInput = this._getComponent().getDomRef().getBoundingClientRect();
Expand Down

0 comments on commit a98c6bd

Please sign in to comment.