Et2InputWidget: New strategy for splitting label, keep it in the shadowDOM

This commit is contained in:
nathan 2024-04-24 08:57:50 -06:00
parent 219abb15f7
commit b3609b3f4a

View File

@ -450,13 +450,8 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
{ {
const label = document.createElement("et2-description"); const label = document.createElement("et2-description");
label.innerText = post; label.innerText = post;
// Put in suffix, if parent has a suffix slot // Add into shadowDOM (may go missing, in which case we need a different strategy)
if(this.parentNode?.shadowRoot?.querySelector("slot[name='suffix']")) this.shadowRoot?.querySelector(".form-control-input").after(label);
{
label.slot = "suffix";
}
this.parentNode.append(label);
}); });
} }
} }