Skip to content

armgit / core

Public Imported from GitHub
0

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

floating label now correctly shown when input value is 0 (#987)

DonWillemsedba652958f4
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 bde671ea7..366f9ea9c 100644
--- a/ui/component/or-mwc-components/src/or-mwc-input.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-input.ts
@@ -868,7 +868,7 @@ export class OrMwcInput extends LitElement {
"mdc-text-field-helper-text--persistent": !showValidationMessage && this.helperPersistent,
"mdc-text-field-helper-text--validation-msg": showValidationMessage,
};
- const hasValue = this.value || this.value === false;
+ const hasValue = (this.value !== null && this.value !== undefined) || this.value === false;
let labelTemplate = showLabel ? html`<span class="mdc-floating-label ${hasValue ? "mdc-floating-label--float-above" : ""}" id="label">${this.label}</span>` : undefined;
switch (this.type) {