mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
Prevents error if sl-input has value undefined (#513)
The sl-input's value state being `undefined` is very common when using shoelace with frameworks. Instead of erroring out and not showing the input, this should handle it gracefully.
This commit is contained in:
@@ -295,7 +295,7 @@ export default class SlInput extends LitElement {
|
||||
'input--pill': this.pill,
|
||||
'input--disabled': this.disabled,
|
||||
'input--focused': this.hasFocus,
|
||||
'input--empty': this.value.length === 0,
|
||||
'input--empty': this.value?.length === 0,
|
||||
'input--invalid': this.invalid
|
||||
})}
|
||||
>
|
||||
@@ -344,7 +344,7 @@ export default class SlInput extends LitElement {
|
||||
@blur=${this.handleBlur}
|
||||
/>
|
||||
|
||||
${this.clearable && this.value.length > 0
|
||||
${this.clearable && this.value?.length > 0
|
||||
? html`
|
||||
<button
|
||||
part="clear-button"
|
||||
|
||||
Reference in New Issue
Block a user