Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant flicker on broken image #170

Open
zspitz opened this issue Sep 19, 2024 · 0 comments
Open

Constant flicker on broken image #170

zspitz opened this issue Sep 19, 2024 · 0 comments

Comments

@zspitz
Copy link

zspitz commented Sep 19, 2024

Describe the bug
If any of the images higher up in the column are broken, the rest of the column starts flickering

To Reproduce
Sandbox here: https://codesandbox.io/p/sandbox/sparkling-cache-3cpp8v

(I'm not sure why some of the images are broken, but that seems to be a separate issue.)

Expected behavior
No flicker.

Screenshots

MasonryScroller image flicker

(Note that when live the column continues to flicker; it's only the GIF which has come to an end.)

Desktop:

  • OS: Windows
  • Browser Firefox/Chrome
  • Version Firefox 130.0.1 / Chrome 129.0.6668.59 / Masonic 4.0.1

Smartphone:

(not tested)

Additional context

This doesn't happen with the basic Masonry component, only with MasonryScroll.

AFAICT the initial measurement doesn't take into account the height of the broken image placeholder inserted by the browser. When the browser gets around to inserting the placeholder, that triggers a React re-render; in which the measurement again doesn't include the height of the placeholder.

Setting alt to an empty or short string stops the flickering, presumably because the browser doesn't render the placeholder (other methods for doing the same thing might also work):

image

If there are no broken images in the initial viewport, scrolling down until a broken image comes into view triggers the flicker.

Moving to a different browser tab or a different window and then back, stops the flicker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant