Skip to content

Commit 2c0844c

Browse files
perf: defer computing styles until opened (#9485) (#9487)
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
1 parent cad5331 commit 2c0844c

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

packages/popover/src/vaadin-popover-overlay-mixin.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,6 @@ export const PopoverOverlayMixin = (superClass) =>
5757
return 'vaadin-popover';
5858
}
5959

60-
requestContentUpdate() {
61-
super.requestContentUpdate();
62-
63-
// Copy custom properties from the owner
64-
if (this.positionTarget && this.owner) {
65-
const style = getComputedStyle(this.owner);
66-
['top', 'bottom', 'start', 'end'].forEach((prop) => {
67-
this.style.setProperty(
68-
`--${this._tagNamePrefix}-offset-${prop}`,
69-
style.getPropertyValue(`--${this._tagNamePrefix}-offset-${prop}`),
70-
);
71-
});
72-
}
73-
}
74-
7560
/**
7661
* @protected
7762
* @override
@@ -83,6 +68,15 @@ export const PopoverOverlayMixin = (superClass) =>
8368
return;
8469
}
8570

71+
// Copy custom properties from the owner
72+
if (this.owner) {
73+
const style = getComputedStyle(this.owner);
74+
['top', 'bottom', 'start', 'end'].forEach((prop) => {
75+
const propertyName = `--${this._tagNamePrefix}-offset-${prop}`;
76+
this.style.setProperty(propertyName, style.getPropertyValue(propertyName));
77+
});
78+
}
79+
8680
this.removeAttribute('arrow-centered');
8781

8882
// Center the overlay horizontally

0 commit comments

Comments
 (0)