Repository navigation
Open
Labels
browser-firefoxengine-geckoThe browser uses the Gecko rendering enginepriority-normalseverity-minorThe site has a cosmetic issue.type-cssGeneric CSS issuestype-jsGeneric JS issues
Milestone
Description
Browser / Version: Firefox Nightly 68.0a1 (2019-03-20)
Operating System: Windows 10 Pro
Tested Another Browser: Yes
Problem type: Design is broken
Description: Star rating UI elements are not properly displayed
Steps to Reproduce:
- Navigate to https://www.lazada.com.ph/products/bose-soundsport-free-wireless-headphones-midnight-blue-i156795182-s189140091.html?spm=a2o6y.10450891.0.0.3045c92ejLfoVR
- Scroll down to the "Ratings & Reviews of Bose SoundSport Free Wireless Headphones - Midnight Blue" section.
- Observe the star rating UI elements.
Expected Behavior:
The star components of each UI element must be inline.
Actual Behavior:
The last component of each element is displayed on a different line.
Notes:
- The issue is not reproducible on Chrome 72.0.3626.121
- Screenshot attached.
Affected area:
<li>
<div class="container-star progress-title" style="width:79.80000000000001px;height:15.96px">
<img class="star" src="//laz-img-cdn.alicdn.com/tfs/TB19ZvEgfDH8KJjy1XcXXcpdXXa-64-64.png" style="width:15.96px;height:15.96px">
<img class="star" src="//laz-img-cdn.alicdn.com/tfs/TB19ZvEgfDH8KJjy1XcXXcpdXXa-64-64.png" style="width:15.96px;height:15.96px" data-spm-anchor-id="a2o4l.pdp.ratings_reviews.i1.336972fdppqytV">
<img class="star" src="//laz-img-cdn.alicdn.com/tfs/TB19ZvEgfDH8KJjy1XcXXcpdXXa-64-64.png" style="width:15.96px;height:15.96px">
<img class="star" src="//laz-img-cdn.alicdn.com/tfs/TB19ZvEgfDH8KJjy1XcXXcpdXXa-64-64.png" style="width:15.96px;height:15.96px">
<img class="star" src="//laz-img-cdn.alicdn.com/tfs/TB19ZvEgfDH8KJjy1XcXXcpdXXa-64-64.png" style="width:15.96px;height:15.96px">
</div>
<span class="progress-wrap">
<div class="pdp-review-progress">
<div class="bar bg"></div>
<div class="bar fg" style="width:80%"></div>
</div>
</span>
<span class="percent">8</span>
</li>Watchers:
@softvision-oana-arbuzov
@softvision-sergiulogigan
@cipriansv
Browser Configuration
- None
From webcompat.com with ❤️
Metadata
Metadata
Assignees
Labels
browser-firefoxengine-geckoThe browser uses the Gecko rendering enginepriority-normalseverity-minorThe site has a cosmetic issue.type-cssGeneric CSS issuestype-jsGeneric JS issues
Activity
[-]www.lazada.com.ph - design is broken[/-][+]www.lazada.com.ph - Star rating UI elements are not properly displayed[/+]karlcow commentedon Mar 25, 2019
The size seems to be dynamically adjusted given the values into each style attribute.
The width of the wrapper is
79.80000000000001pxThe width of each img is
15.96px15.96 * 5 = 79.8pxwhich makes it really tight and subject to any pixels rounding issue.
for example if I set it to be
79.83px;this is working. And If we want to be more precise.79.82499313354491pxFAIL79.82499313354492pxworkingwhich makes a diffference of
0.02499313354pxin between Chrome and Firefox.This is computed here:
t = {score:5, size:12}a = 12r = 12so
m = 1.33 * rso15.96width: 5 * mso79.8which I guess for chrome with the rounding issues gives
79.80000000000001pxThe computed sizes as displayed in the layout with
getBoundingClientRect()Chrome
width: 15.953125, height: 15.953125width: 79.796875, height: 15.953125Firefox
width: 15.966659545898438, height: 15.9666748046875width: 79.80000305175781, height: 15.9666748046875I guess the main difference is here in the layout.
@dholbert Can we consider this acceptable differences? Of should it be the same values?
TO NOTE: If they remove the width constraint on the container. Everything is working.
OR: They could change the display value of the container, and it would not wrap anymore.
I'm pushing to needscontact.
dholbert commentedon Mar 25, 2019
Yeah, Firefox's layout engine doesn't support CSS sizes with a fine enough precision to represent exact hundredths-of-a-pixel. We use a fixed point representation which rounds to the nearest 60th of a pixel.
So, if the site has
width: 15.96px, then for layout purposes, we round that to the nearest 60th-of-a-pixel which is15.966667px(which introduces a rounding error of.006667px) -- and with 5 of these rounded-up widths, we would end up with a collective.03333px(repeating) of rounding error, which is why we end up barely overshooting the width of the container.We have https://bugzilla.mozilla.org/show_bug.cgi?id=265084 filed on thinking about changing our representation, but it's unlikely to happen soon. So for now, we should recommend that sites avoid depending on fine-tuned barely-fitting layout arithmetic with hardcoded hundredth-of-a-pixel sizes.
dholbert commentedon Mar 25, 2019
And in particular: if a site wants to precisely divide up a width into N equal chunks, the most reliable way to do that is using CSS Flexbox. E.g. if they restyle the wrapper here to have
display: inline-flex, then this Just Works, as karl observed above (because, by default, flexbox will detect the tiny overflow of all the desired sizes (from the rounding error in our representation of15.96px), and it'll shrink each item fairly (and negligibly in this case) to fit.