GithubHelp home page GithubHelp logo

Comments (4)

timmyc avatar timmyc commented on June 15, 2024

@obenland what are the steps to reproduce this - I can't seem to trigger it myself.

from wp-core-media-widgets.

obenland avatar obenland commented on June 15, 2024

To reproduce:

  1. Set an image and select thumbnail size.
  2. Save the widget/customizer preview.
  3. Reload.
  4. Expand widget toggle.

from wp-core-media-widgets.

westonruter avatar westonruter commented on June 15, 2024

Should the image size in the preview be a medium, like the default widget image size, rather than full?

Yes, if the medium size is available, it should be shown instead of full. This is currently being done in the media control actually, but I seem to have missed it in the template for the image control. See https://github.com/WordPress/wordpress-develop/blob/5fcfb9b247474e98a5deaa6f04781f3e99583094/src/wp-includes/customize/class-wp-customize-media-control.php#L159-L160

from wp-core-media-widgets.

westonruter avatar westonruter commented on June 15, 2024

When previewing an attachment image in the widget preview and the selected size is not the full size, there is a flash of the selected image before the full attachment object has loaded and the image is replaced with its full size. ¶ Should we wait showing a preview of the image until the attachment object has loaded?

The reason this is happening is that we're currently storing the selected image size URL in the model's url attribute. If the attachment is not loaded yet, then it essentially falls-back to the url for preview in the control and also in \WP_Widget_Media_Image::render_media().

In the control preview template (\WP_Widget_Media_Image::render_control_template_scripts()), this is the problematic line:

<img class="attachment-thumb" src="{{ data.attachment_id && data.attachment.url ? data.attachment.url : data.url }}" draggable="false" alt="{{ data.alt }}" <# if ( ! data.alt ) { #> aria-describedby="{{ describedById }}" <# } #> />

So perhaps when data.attachment_id && ! data.attachment.url the template should display a spinner instead? Or perhaps we could continue to show the current cached image url but with opacity:0.5 to indicate it is still loading?

from wp-core-media-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.