[wp-trac] [WordPress Trac] #36096: Custom Logo: Improper image size appears momentarily after selection (was: Custom Logo: Use of custom image size requires unexpected filtering of image_size_names_choose)
WordPress Trac
noreply at wordpress.org
Thu Mar 10 18:11:33 UTC 2016
#36096: Custom Logo: Improper image size appears momentarily after selection
--------------------------+--------------------------
Reporter: westonruter | Owner: westonruter
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.5
Component: Customize | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+--------------------------
Old description:
> In testing the Custom Logo in Twenty Sixteen, I found a strange bug where
> the the logo would appear momentarily in a large size and then get
> resized down properly. The properly-sized logo would appear once the
> selective refresh request returned. The momentarily-oversized image was
> the one updated via the `postMessage` preview logic. See screencast:
> https://youtu.be/JkQGhB_LzGo
>
> I found that the media `get-attachment` Ajax request was not returning
> the `twentysixteen-logo` among the available sizes. I was surprised to
> find that in order to get a custom image size to be returned from the
> media `get-attachment` Ajax queries, the image size had to be explicitly
> added to the `image_size_names_choose` filter. This filter is probably
> specifically for the UI to ensure that there are names for the sizes to
> show, but this makes it a headache for themers to add support for Custom
> Logos.
>
> Here is what a theme currently has to do to add support using a custom
> image size as a custom logo:
> https://github.com/WordPress/twentysixteen/pull/434
New description:
In testing the Custom Logo in Twenty Sixteen, I found a strange bug where
the the logo would appear momentarily in a large size and then get resized
down properly. The properly-sized logo would appear once the selective
refresh request returned. The momentarily-oversized image was the one
updated via the `postMessage` preview logic. See screencast:
https://youtu.be/JkQGhB_LzGo
I found that the media `get-attachment` Ajax request was not returning the
`twentysixteen-logo` among the available sizes. I was surprised to find
that in order to get a custom image size to be returned from the media
`get-attachment` Ajax queries, the image size had to be explicitly added
to the `image_size_names_choose` filter. This filter is probably
specifically for the UI to ensure that there are names for the sizes to
show, but this makes it a headache for themers to add support for Custom
Logos.
Here is what a theme currently has to do to add support using a custom
image size as a custom logo:
https://github.com/WordPress/twentysixteen/pull/434
UPDATE: We can go ahead and remove the JS logic for applying the image
change directly in favor of just relying on selective refresh. See
comments at https://core.trac.wordpress.org/ticket/36096#comment:13
--
Comment (by westonruter):
(This will eliminate the bug where a theme could see a large image appear
momentarily for a custom logo.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36096#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list