Skip to content

Commit c5edaa8

Browse files
committed
fix: use the most recent IntersectionObserver entry in form-layout (#8596)
1 parent f4c390a commit c5edaa8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ class FormLayout extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))
272272
constructor() {
273273
super();
274274

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

0 commit comments

Comments
 (0)