Closed Bug 2068042 Opened 2 months ago Closed 2 months ago

robertsspaceindustries.com - Broken layout, elements not rendered correctly

Categories

(Core :: CSS Parsing and Computation, defect, P1)

Firefox 156
Desktop
Windows 10
defect

Tracking

()

VERIFIED FIXED
157 Branch
Webcompat Priority P1
Webcompat Score 9
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox155 --- unaffected
firefox156 --- disabled
firefox157 --- verified

People

(Reporter: ctanase, Assigned: emilio)

References

(Regression, )

Details

(Keywords: regression, webcompat:platform-bug, webcompat:site-report, Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success], [wptsync upstream])

User Story

autowebcompat-repro-status:success
autowebcompat-repro-chrome-mask-fixed:false
autowebcompat-repro-channels:nightly
autowebcompat-repro-report-os:all
autowebcompat-diagnosis-status:success
platform:windows,mac,linux,android
impact:site-broken
configuration:general
affects:all
branch:release
diagnosis-team:layout
user-impact-score:1500

Attachments

(4 files, 1 external file)

Environment:
Operating system: Windows 11/10
Firefox version: Firefox Nightly Version 157.0a1

Steps to reproduce:

  1. Go to https://robertsspaceindustries.com/en/
  2. Dismiss the cookie banner.
  3. Observe the page.

Expected Behavior:
The elements are rendered correctly.

Actual Behavior:
The layout is broken, elements are missing or not rendered correctly.

Notes:

  • Reproduces regardless of the status of ETP
  • Reproduces in firefox-nightly and beta
  • Does not reproduce in firefox-release (154), and chrome

Created from https://github.com/webcompat/web-bugs/issues/233231

Attached image image.png —
Version: unspecified → Firefox 157
Whiteboard: [webcompat-source:web-bugs] → [webcompat-source:web-bugs][autowebcompat:processed]
User Story: (updated)
Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnose]

In Firefox Nightly the RSI homepage renders raw CSS source as visible page text (:root { --rsi-mini-bar-height: 2.5rem; }, --orion-navigation-bar-height, --rsi-footer-height), and the navigation bar is blown up into a tall vertical block instead of a single row, pushing the hero image/carousel off screen. Chrome renders the same page correctly: no CSS text is exposed, the nav bar is a normal single-row bar, and the hero content is visible.

Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnose] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnosis-in-progress]

Root cause analysis generated by autowebcompat bot:

Firefox engine bug in :host selector matching (not UA sniffing). The site ships Swiper's CSS inside an inline document stylesheet, namespaced by its build with a [data-orion-skin] prefix, producing the rule "[data-orion-skin] :host { position: relative; display: block; margin-left: auto; margin-right: auto; z-index: 1 }". The page has body[data-orion-skin]. Per CSS Scoping (https://drafts.csswg.org/css-scoping/#host-selector) :host only matches the shadow host of the shadow tree in which the containing rule appears, so in a document stylesheet it must match nothing, and Chrome treats the rule as inert. Firefox Nightly instead treats a bare :host that appears after a combinator in a complex selector as if it were the universal selector, so "[data-orion-skin] :host" matches every descendant of body and applies display:block to all of them. Two consequences produce the reported breakage. First, display:block overrides the UA stylesheet rule that hides style elements (https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements), so the raw CSS source of the site's injected style blocks is laid out and painted as page text. Second, those now-rendered style blocks sit inside header.o-navigationBar and inside the footer wrapper, and the site's JS measures those containers and writes the result into --orion-navigation-bar-height and --rsi-footer-height; the extra text inflates the measurement to 18.125rem (290px) instead of 4rem (64px) for the nav bar and 76.71875rem for the footer, which pushes the hero/carousel off screen. Narrow divergence: a bare :host in a non-shadow stylesheet, when it is not the first compound of the selector, matches all elements in Firefox and nothing in Chrome.

Evidence:

Live site, 1366x768, default prefs. Firefox: 3 leaked CSS strings in body innerText, nav height 290px, --orion-navigation-bar-height computes to 18.125rem. Chrome: 0 leaked strings, nav height 64px, var 4rem. Identical 17 style elements in both browsers, so no UA sniffing. The leaked text nodes are children of real HTMLStyleElements inside header.o-navigationBar, the platform footer, and a body-level div; their computed display is block in Firefox and none in Chrome, with no inline style attribute and no shadow DOM. Disabling all document stylesheets in Firefox restored display none, so an author rule was responsible. Re-enabling sheets one at a time isolated two inline sheets, and replaying each of that sheet's 488 rules individually into a constructed stylesheet pinpointed exactly one, rule index 462, the Swiper rule with the "[data-orion-skin] :host" selector setting display block. Adopting a probe sheet with that same selector and an outline declaration highlighted 282 of 520 elements in Firefox, including STYLE and SCRIPT, so :host behaved as a universal match. Element.matches with that selector returns false and querySelectorAll returns 0, so the divergence is in style rule matching rather than the selector API. Further probes in Firefox: bare :host matches 0 elements, :host(div) matches 0, "div :host-context(x)" matches 0, but "div :host" matches every descendant of every div. The reduced testcase puts "#wrap :host" with display block in a plain document stylesheet and a style element inside the wrapper. Firefox Nightly: 3 matched elements, leaky style display block, 1 leaked :root string, broken true. Chrome: 0 matched, display none, 0 leaked strings, broken false. Same divergence as the live site.

User Story: (updated)
Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnosis-in-progress] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success]
User Story: (updated)

Claude analysis

Bug 2048847 (95301699ebff) added bucketing that marks a selector's subject compound as known-matching so matching can be skipped, but its Component::Host(None) arm deliberately leaves bucket_matches untouched (":host rules are bucketed") — which only holds for shadow-tree host rules. For a bare :host after a combinator in a document stylesheet, the rule lands in the universal bucket as BucketMatches::Subject, so Rule::matches_selector calls iter_past_subject and skips the :host check entirely — making it match every element. That's exactly the site's [data-orion-skin] :host { display: block; ... } rule un-hiding every injected <style>

:emilio, since you are the author of the regressor, bug 2048847, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Component: Site Reports → CSS Parsing and Computation
Product: Web Compatibility → Core
Version: Firefox 157 → Firefox 156
User Story: (updated)
Webcompat Priority: --- → P1
Webcompat Score: --- → 9
Duplicate of this bug: 2068581
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

Let's back out the regressor from beta instead, Donal is that possible?

Flags: needinfo?(emilio) → needinfo?(dmeehan)
Duplicate of this bug: 2068508

(In reply to Emilio Cobos Álvarez [:emilio] from comment #13)

Let's back out the regressor from beta instead, Donal is that possible?

The regressor Bug 2048847 was reverted from Fx156 beta

Flags: needinfo?(dmeehan)

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/62439 for changes under testing/web-platform/tests

Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success], [wptsync upstream]

Upstream PR merged by moz-wptsync-bot

QA Whiteboard: [qa-triage-done-c158/b157]

Verified as FIXED using the RC Build

Tested with:

Browser / Version: Firefox 157.0-candidate build 1
Operating System: Windows 10 PRO x64

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: