From 4567d8a76ca7d52e44ba55e4adf5888d9753a406 Mon Sep 17 00:00:00 2001 From: ilhan orhan Date: Tue, 9 Jan 2024 15:28:28 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui5-select):=20correct=20"value"=20setter?= =?UTF-8?q?=20to=20operate=20on=20the=20light=20DOM=20(#8067)=20:=D0=B2?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/main/src/Select.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/main/src/Select.ts b/packages/main/src/Select.ts index 2c760c8158b0..defd6fd54eaa 100644 --- a/packages/main/src/Select.ts +++ b/packages/main/src/Select.ts @@ -467,6 +467,8 @@ class Select extends UI5Element implements IFormElement { this._onMenuChange = this.onMenuChange.bind(this); this._attachMenuListeners = this.attachMenuListeners.bind(this); this._detachMenuListeners = this.detachMenuListeners.bind(this); + + this._upgradeProperty("value"); } onBeforeRendering() { @@ -540,8 +542,11 @@ class Select extends UI5Element implements IFormElement { * @formEvents change liveChange */ set value(newValue: string) { - this.selectOptions.forEach(option => { - option.selected = !!((option.value || option.textContent) === newValue); + const menu = this._getSelectMenu(); + const selectOptions = Array.from(menu ? menu.children : this.children).filter(option => !option.getAttribute("disabled")) as Array; + + selectOptions.forEach(option => { + option.selected = !!((option.getAttribute("value") || option.textContent) === newValue); }); }