kopia lustrzana https://github.com/shoelace-style/shoelace
fix label when items are dynamically added
rodzic
8aa9466d6b
commit
f50d354ceb
|
|
@ -6,6 +6,10 @@ Components with the <sl-badge type="warning" pill>Experimental</sl-badge> badge
|
||||||
|
|
||||||
_During the beta period, these restrictions may be relaxed in the event of a mission-critical bug._ 🐛
|
_During the beta period, these restrictions may be relaxed in the event of a mission-critical bug._ 🐛
|
||||||
|
|
||||||
|
## Next
|
||||||
|
|
||||||
|
- Fixed a bug where dynamically changing menu items in `sl-select` would cause the display label to be blank [#374](https://github.com/shoelace-style/shoelace/discussions/374)
|
||||||
|
|
||||||
## 2.0.0-beta.33
|
## 2.0.0-beta.33
|
||||||
|
|
||||||
- Fixed a bug where link buttons could have incorrect `target`, `download`, and `rel` props
|
- Fixed a bug where link buttons could have incorrect `target`, `download`, and `rel` props
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,7 @@ export default class SlSelect extends LitElement {
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
this.resizeObserver = new ResizeObserver(() => this.resizeMenu());
|
this.resizeObserver = new ResizeObserver(() => this.resizeMenu());
|
||||||
|
this.syncItemsFromValue();
|
||||||
// We need to do an initial sync after the component has rendered, so this will suppress the re-render warning
|
|
||||||
requestAnimationFrame(() => this.syncItemsFromValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|
@ -271,10 +269,13 @@ export default class SlSelect extends LitElement {
|
||||||
|
|
||||||
@watch('helpText')
|
@watch('helpText')
|
||||||
@watch('label')
|
@watch('label')
|
||||||
handleSlotChange() {
|
async handleSlotChange() {
|
||||||
this.hasHelpTextSlot = hasSlot(this, 'help-text');
|
this.hasHelpTextSlot = hasSlot(this, 'help-text');
|
||||||
this.hasLabelSlot = hasSlot(this, 'label');
|
this.hasLabelSlot = hasSlot(this, 'label');
|
||||||
this.syncItemsFromValue();
|
|
||||||
|
// Wait for items to render before gathering labels otherwise the slot won't exist
|
||||||
|
const items = this.getItems();
|
||||||
|
await Promise.all(items.map(item => item.render)).then(() => this.syncItemsFromValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTagInteraction(event: KeyboardEvent | MouseEvent) {
|
handleTagInteraction(event: KeyboardEvent | MouseEvent) {
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue