Skip to content

Commit 0f3b8e4

Browse files
authored
fix: access DOM in connectedCallback instead of constructor (#524)
1 parent da1c430 commit 0f3b8e4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/base/src/UI5Element.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ class UI5Element extends HTMLElement {
5757
}
5858

5959
async _initializeShadowRoot() {
60-
const isCompact = getCompactSize();
61-
62-
if (isCompact) {
63-
this.setAttribute("data-ui5-compact-size", "");
64-
}
65-
6660
if (this.constructor.getMetadata().getNoShadowDOM()) {
6761
return Promise.resolve();
6862
}
@@ -82,6 +76,11 @@ class UI5Element extends HTMLElement {
8276
}
8377

8478
async connectedCallback() {
79+
const isCompact = getCompactSize();
80+
if (isCompact) {
81+
this.setAttribute("data-ui5-compact-size", "");
82+
}
83+
8584
if (this.constructor.getMetadata().getNoShadowDOM()) {
8685
return;
8786
}

0 commit comments

Comments
 (0)