Open Bug 1878024 Opened 2 years ago Updated 1 month ago

Account icon is squashed while logged in on g1.globo.com

Categories

(Web Compatibility :: Site Reports, defect, P3)

Firefox 124
Desktop
Windows 10

Tracking

(Webcompat Priority:P3, Webcompat Score:1, firefox122 affected, firefox124 affected)

ASSIGNED
Webcompat Priority P3
Webcompat Score 1
Tracking Status
firefox122 --- affected
firefox124 --- affected

People

(Reporter: ctanase, Assigned: twisniewski)

References

(Depends on 1 open bug, )

Details

(4 keywords, Whiteboard: [webcompat:sightline][webcompat:core])

User Story

platform:windows,mac,linux,android
impact:minor-visual
configuration:general
affects:all
branch:release
diagnosis-team:layout
user-impact-score:3

Attachments

(7 files, 1 obsolete file)

Environment:
Operating system: Windows 10
Firefox version: Nightly 124.0a1 (2024-01-31)

Preconditions: must be logged in

Steps to reproduce:

  1. Go to https://g1.globo.com
  2. Observe the account icon located at the top right corner of the page

Expected Behaviour:
Account icon is displayed correctly.

Actual Behaviour:
The account icon is squashed.

Notes:

  1. Screenshot attached
  2. Reproducible on Firefox Release as well
  3. Reproducible for other subdomains as well (ge.globo.com / receitas.globo.com etc.)
  4. Not reproducible on Chrome
  5. Issue found during WebCompat team [Top100] websites testing
Priority: P3 → --

This might be similar to bug 1878012, where we also have some weird proportion issue (in that case it's a SVG).

Severity: -- → S4
Priority: -- → P2
See Also: → 1878012
Severity: S4 → S3
User Story: (updated)

We don't have a login to test with, so we're stuck.

Calin, could you try to use my Testcase Reducer addon to get us a test-case to work with? (Feel free to reach out to me if you'd like guidance on how to use it).

User Story: (updated)
Flags: needinfo?(ctanase)

As discussed via slack, the affected area won't be visible when using the Testcase Reducer addon.

Note: Login can be performed with a google account.

Flags: needinfo?(ctanase)
User Story: (updated)
Attached file Reduced test case (obsolete) —
Attached file Reduced test case

More reduced this time.

Attachment #9433478 - Attachment is obsolete: true

Thanks for the testcases. Here's one more with a <canvas> to make the markup a bit more compact (nice way to get a replaced element with an intrinsic width/height without needing a data URI).

It looks like Chrome is treating the replaced element's width: 100% as establishing its automatic minimum size, whereas we're giving it an automatic minimum size of 0. This testcase demonstrates that behavior-difference -- particularly the bottom part with the greedy sibling, where we let the replaced element be shrunk to have a content-box width of 0.

I tried your test case in Chrome, Safari, Servo and Ladybird and they all agree. Firefox is the odd one out.

If I adjust my testcase to use a px value for width instead of a percent (just filling in the value that the percent should ultimately resolve to), then we change to match Chrome.

Attachment #9433719 - Attachment description: testcase with canvas but now with px-valued `width` → testcase with canvas but now with px-valued `width` (we match other browsers on this one)

I spun off bug 1927554 as a platform bug here.

Depends on: 1927554

Bug 1927554 is a dup of bug 1700474.

Depends on: 1700474
No longer depends on: 1927554
Whiteboard: [webcompat:sightline]
Webcompat Priority: --- → P2
Webcompat Score: --- → 7

Hopefully we can get to an interoperable state on bug 1700474 before too long, but for the short term I'd suggest we sitepatch the issue here with the following:
===SUGGESTED SITEPATCH===

.base-container .button-login-icon img {
  flex-shrink: 0
}

===END SUGGESTED SITEPATCH===

This prevents this image from getting compressed in the way that it is now.

Additional background/notes:
The sitepatch is intended as an extension of the following CSS rule that the site has (at least, it's present in Jeff's "standalone reduced test case"):

.base-container .button-login-icon img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  margin-right: var(--spacing-50);
}

They're putting this image in a 32px by 32px flex container, and they give the image width: 100%; height: 100%; as quoted above to fill that container (i.e. the image tries to be 32x32) -- BUT they also give the image an 8px margin-right via that margin-right declaration (since they have --spacing-50: 8px defined elsewhere). So that 8px margin-right steals 8px of space from the container and forces the image to try to shrink, if it's shrinkable.

We don't have interop on whether or not an img is "compressible" in this situation (that's bug 1700474), but one trivial way to make it not compressible is to just give it flex-shrink:0.

Ah, hmm -- I just tested on the live site (logging in with a secondary Google account per comment 3) and I found that my suggested sitepatch doesn't quite work, since the element in question is inside of a custom element, and outside CSS rules (like e.g. a rule that I write in the Stylus addon-on in my case) doesn't match elements inside the shadow DOM of that custom element.

Tom, do you know if we have a way of shipping sitepatches that target the shadow-DOM internals of custom elements?

Flags: needinfo?(twisniewski)

Ah, looks like we can do it with JS -- this works (note that there's only one <nova-barra-globocom> element in the page, so querySelector matches that one element and there aren't others to worry about). The timing of this JS might be a little fiddly though since that one element doesn't render right away. But if I wait for it to render and then execute this JS, things end up looking good.

let customElem = document.querySelector("nova-barra-globocom");
if (customElem) {
  let sheet = new CSSStyleSheet;
  let sheetText = ".base-container .button-login-icon img { flex-shrink: 0; }";
  sheet.replaceSync(sheetText);
  customElem.shadowRoot.adoptedStyleSheets.push(sheet);
};
Flags: needinfo?(twisniewski)
Keywords: leave-open
Assignee: nobody → twisniewski
Status: NEW → ASSIGNED

This should really just be minor visual

Severity: S3 → S4
User Story: (updated)
Webcompat Priority: P2 → P3
Webcompat Score: 7 → 3
Priority: P2 → P3
Pushed by twisniewski@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/197b47516708 add a desktop-only JS intervention for g1.globo.com to fix user profile icons; r=denschub,webcompat-reviewers
Webcompat Score: 3 → 1
User Story: (updated)
Whiteboard: [webcompat:sightline] → [webcompat:sightline][webcompat:core]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: