Fixed 2X Smiley displayed twice as big on iPhone

rfc0001

Well-known member
Set 2X smiley:

1516599967757.webp


Smiley is displayed twice as large as other smilies on iPhone:

1516600324375.webp

Is this the intended behavior or a bug? My expectation is they would all be displayed the same size, the 2X version would just be displayed with higher DPI. In posts, the same smiley is displayed the normal size.
 
This seems like it could be an iOS bug as I cannot reproduce it anywhere else. I suspect it's related to the smilies loading in what starts off as a totally hidden element.

I suspect we'll have to create a reduced test case and send it to Apple.
 
This seems like it could be an iOS bug as I cannot reproduce it anywhere else. I suspect it's related to the smilies loading in what starts off as a totally hidden element.

I suspect we'll have to create a reduced test case and send it to Apple.
However, it appears to be displayed correctly in a post. It is just double the size in the smiley drop down. Is there a difference between how those are rendered?
 
Yeah as I mentioned I thought it could be that the smilies are initially hidden; but it actually seems more nuanced than that. It seems to be when a smilie is loaded over an Ajax request.

You can see a similar thing when you load the smilie “Sort” overlay in the Admin CP.
 
Our users have reported this issue, too. The fix / workaround isn't obvious but simple:

Diff:
diff --git a/src/XF/Str/Formatter.php b/src/XF/Str/Formatter.php
index f55bd517f..abc7dd44a 100644
--- a/src/XF/Str/Formatter.php
+++ b/src/XF/Str/Formatter.php
@@ -219,7 +219,7 @@ class Formatter
             if (!empty($smilie['image_url_2x']))
             {
                 $url2x = htmlspecialchars($pather ? $pather($smilie['image_url_2x'], 'base') : $smilie['image_url_2x']);
-                $srcSet = 'srcset="' . $url2x . ' 2x"';
+                $srcSet = 'srcset="' . $url . ' 1x, ' . $url2x . ' 2x"';
             }
 
             return '<img src="' . $url . '" ' . $srcSet . ' class="smilie" alt="' . $smilieText
 
It seems like the proposed workaround causes iOS to load the 1x version. Not good but I'd say that's better than nothing.
 
We'll go with that for now. Must be an iOS bug as far as I can tell but I believe my attempts (ages ago) to create a reduced test case didn't work. Thanks @Steffen.
 
Back
Top Bottom