diff --git a/packages/main/src/Select.hbs b/packages/main/src/Select.hbs index 20136b774245..372072d300c6 100644 --- a/packages/main/src/Select.hbs +++ b/packages/main/src/Select.hbs @@ -2,7 +2,9 @@ class="{{classes.main}}" style="{{styles.main}}" tabindex="{{tabIndex}}"> -
+
{{ctr._text}}
@@ -20,5 +22,9 @@ {{/if}} - -
\ No newline at end of file + + diff --git a/packages/main/src/Select.js b/packages/main/src/Select.js index a9bd4951cef4..c34655ac4281 100644 --- a/packages/main/src/Select.js +++ b/packages/main/src/Select.js @@ -11,6 +11,7 @@ import { import ShadowDOM from "@ui5/webcomponents-base/src/compatibility/ShadowDOM"; import KeyCodes from "@ui5/webcomponents-core/dist/sap/ui/events/KeyCodes"; import ValueState from "@ui5/webcomponents-base/src/types/ValueState"; +import Function from "@ui5/webcomponents-base/src/types/Function"; import Suggestions from "./Suggestions"; // Template @@ -94,6 +95,10 @@ const metadata = { type: Boolean, defaultValue: false, }, + + _fnClickSelectBox: { + type: Function, + }, }, events: /** @lends sap.ui.webcomponents.main.Select.prototype */ { /** @@ -156,6 +161,7 @@ class Select extends WebComponent { this._setSelectedItem(null); this._setPreviewedItem(null); this.Suggestions = new Suggestions(this, "items", true /* move focus with arrow keys */); + this._fnClickSelectBox = this.toggleList.bind(this); } onBeforeRendering() { @@ -163,13 +169,12 @@ class Select extends WebComponent { } /* Event handling */ - onclick(event) { + toggleList() { if (this.disabled) { return; } - if (event.target === this) { - this.Suggestions.toggle(); - } + + this.Suggestions.toggle(); } onkeydown(event) {