Skip to content

Commit f047f75

Browse files
authored
fix: use the most recent IntersectionObserver entry in form-layout (#8596)
1 parent 100f4d1 commit f047f75

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/form-layout/src/vaadin-form-layout-mixin.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ export const FormLayoutMixin = (superClass) =>
124124
// Ensure there is a child text node in the style element
125125
this._styleElement.textContent = ' ';
126126

127-
this.__intersectionObserver = new IntersectionObserver(([entry]) => {
127+
this.__intersectionObserver = new IntersectionObserver((entries) => {
128+
// If the browser is busy (e.g. due to slow rendering), multiple entries can
129+
// be queued and then passed to the callback invocation at once. Make sure we
130+
// use the most recent entry to detect whether the layout is visible or not.
131+
// See https://github.com/vaadin/web-components/issues/8564
132+
const entry = [...entries].pop();
128133
if (!entry.isIntersecting) {
129134
// Prevent possible jump when layout becomes visible
130135
this.$.layout.style.opacity = 0;

0 commit comments

Comments
 (0)