From cc9680633395473451b9f510714916b284643bbe Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Thu, 6 Feb 2025 11:26:18 +0100 Subject: [PATCH] fix(select): lookup after setSelection --- source/components/form/button.mjs | 2 +- source/components/form/select.mjs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/components/form/button.mjs b/source/components/form/button.mjs index 69a3052a7..a7c78a13b 100644 --- a/source/components/form/button.mjs +++ b/source/components/form/button.mjs @@ -314,7 +314,7 @@ function getTemplate() { <button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button, aria-role path:aria.role, - path:aria.label | if:true, + path:aria.label | if:true, type path:type" data-monster-role="button" part="button" diff --git a/source/components/form/select.mjs b/source/components/form/select.mjs index 657a3821d..5ecf9cff2 100644 --- a/source/components/form/select.mjs +++ b/source/components/form/select.mjs @@ -2282,6 +2282,7 @@ function isValueIsEmptyThenGetNormalize(value) { * @returns {Promise<unknown | void>} */ function setSelection(selection) { + const self = this; if (isString(selection) || isInteger(selection)) { const result = convertValueToSelection.call(this, selection); @@ -2328,6 +2329,14 @@ function setSelection(selection) { fireEvent(this, "change"); // https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/291 + const lazyLoadFlag = + this.getOption("features.lazyLoad") && this[lazyLoadDoneSymbol] !== true; + let remoteFilterFlag = getFilterMode.call(this) === FILTER_MODE_REMOTE; + + if (lazyLoadFlag || remoteFilterFlag) { + lookupSelection.call(self); + } + return new Processing(() => { const CLASSNAME = "selected"; -- GitLab