UX: fix #1873, allow SvelteUIElements to be a span

This commit is contained in:
Pieter Vander Vennet 2024-04-12 15:16:33 +02:00
parent 6812ab3890
commit 9163d57039
2 changed files with 9 additions and 3 deletions

View file

@ -22,6 +22,7 @@ export default class SvelteUIElement<
private readonly _props: Props
private readonly _events: Events
private readonly _slots: Slots
private tag : "div" | "span" = "div"
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
super()
@ -31,8 +32,13 @@ export default class SvelteUIElement<
this._slots = slots
}
public setSpan(){
this.tag = "span"
return this
}
protected InnerConstructElement(): HTMLElement {
const el = document.createElement("div")
const el = document.createElement(this.tag)
new this._svelteComponent({
target: el,
props: this._props,

View file

@ -1017,7 +1017,7 @@ export default class SpecialVisualizations {
state,
feature,
layer
}).SetClass("px-1")
}).SetClass("px-1").setSpan()
})
)
},
@ -1249,7 +1249,7 @@ export default class SpecialVisualizations {
download: tagSource.map(tags => Utils.SubstituteKeys(download, tags)),
ariaLabel: tagSource.map(tags => Utils.SubstituteKeys(ariaLabel, tags)),
newTab: new ImmutableStore(newTab)
})
}).setSpan()
}
},
{