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

Add Image Prefetching for Click to expand Images #61107

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

Takshil-Kunadia
Copy link
Contributor

@Takshil-Kunadia Takshil-Kunadia commented Apr 25, 2024

PR For :- Issue #60883

What?

Prefetch full-resolution image to speed up display of Click to expand images.
see #60883 for more details

Why?

Hovering over a click-to-expand image block does not proactively attempt to prefetch the full-scale image in Lighbox. This can result in a prolonged period in which the low-resolution scaled-up image is displayed in the lightbox.

How?

  • Implement prefetchImage action that prefetches an image and keeps it in the browser cache.
  • Then utilising the above add pointer event directives that trigger it on pointerup & pointerdown.

Testing Instructions

  1. Create a post with a click to expand image on it.
  2. Open Dev tools and throttle network to slow 3G and notice the network tab.
  3. Hover over the image, this will trigger the image to load.
  4. When the loading is complete, click the image for it to load in full resolution without any delay or loading.

Testing Instructions for Keyboard

Screenshots or screencast

Screenshot 2024-04-25 at 10 18 51 PM

Copy link

github-actions bot commented Apr 25, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Takshil-Kunadia <takshil@git.wordpress.org>
Co-authored-by: artemiomorales <artemiosans@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Takshil-Kunadia Takshil-Kunadia force-pushed the feature/prefetch-lightbox-images branch from 68fcd2d to 5c10b84 Compare April 25, 2024 16:58
@artemiomorales
Copy link
Contributor

@Takshil-Kunadia Thanks for creating this PR! I've left a comment on the issue to loop a few other folks into the discussion who may have thoughts on how to best proceed. In short, we previously had prefetching on hover but removed it. Since then, there's been more discussion around this, so perhaps may be good to add this back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants