Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

when clicking icon it wouldn't select the element but now it does

Vincent77b40185a8d2
diff --git a/ui/component/or-mwc-components/src/or-mwc-input.ts b/ui/component/or-mwc-components/src/or-mwc-input.ts
index a5c9f419b..f25d48ef0 100644
--- a/ui/component/or-mwc-components/src/or-mwc-input.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-input.ts
@@ -869,16 +869,17 @@ export class OrMwcInput extends LitElement {
inputValue.push(value);
}
const listItemEl = (ev.composedPath()[0] as HTMLElement).closest("li") as HTMLElement,
- icon = (ev.composedPath()[0] as HTMLElement).getElementsByTagName("or-icon")[0] as OrIcon;
- if (icon) {
+ iconEl = listItemEl.getElementsByTagName("or-icon")[0] as OrIcon;
+ if (listItemEl) {
if (index >= 0) {
- icon.icon = "checkbox-blank-outline";
listItemEl.classList.remove("mdc-list-item--selected");
} else {
- icon.icon = "checkbox-marked";
listItemEl.classList.add("mdc-list-item--selected");
}
}
+ if (iconEl) {
+ iconEl.icon = index >= 0 ? "checkbox-blank-outline" : "checkbox-marked";
+ }
this._tempValue = inputValue;
}
};