From 8fe6d84f8237e13455f78e847fa694e874214920 Mon Sep 17 00:00:00 2001 From: Filip Siderov Date: Thu, 8 Oct 2020 07:49:14 +0300 Subject: [PATCH] fix(ui5-input): deselect suggestion items on input (#2285) Fixes #2256 --- packages/main/src/Input.js | 4 ++++ packages/main/src/features/InputSuggestions.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/packages/main/src/Input.js b/packages/main/src/Input.js index b583edd3b73e..3682b41f700c 100644 --- a/packages/main/src/Input.js +++ b/packages/main/src/Input.js @@ -605,6 +605,10 @@ class Input extends UI5Element { return this._handleEscape(event); } + if (this.showSuggestions) { + this.Suggestions._deselectItems(); + } + this._keyDown = true; } diff --git a/packages/main/src/features/InputSuggestions.js b/packages/main/src/features/InputSuggestions.js index 2c6cef2821be..526ed70d6024 100644 --- a/packages/main/src/features/InputSuggestions.js +++ b/packages/main/src/features/InputSuggestions.js @@ -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();