Closed Bug 1958206 Opened 1 year ago Closed 9 months ago

Sticky positioned element inside subgrid is contained to top level grid, not to subgrid box.

Categories

(Core :: Layout: Grid, defect)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
147 Branch
Webcompat Score 1
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox-esr140 --- wontfix
firefox137 --- wontfix
firefox138 --- wontfix
firefox139 --- wontfix
firefox145 --- wontfix
firefox146 --- verified
firefox147 --- verified

People

(Reporter: rbucata, Assigned: emilio)

References

(Regression, )

Details

(Keywords: regression, Whiteboard: [webcompat-source:web-bugs], [wptsync upstream])

Attachments

(4 files)

Environment:
Operating system: Mac OS X 10.15.7
Firefox version: Firefox 137.0

Steps to reproduce:

  1. Navigate to: https://codepen.io/RJWadley/pen/pvoqwBr
  2. Scroll the page and observe the output

Expected Behavior:
Sticky elements behave the same as in Chrome

Actual Behavior:
Sticky elements behave different compared to Chrome

Notes:

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

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

Attached video chr vs ff.mp4

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

Set release status flags based on info from the regressing bug 1679797

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

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

I'm not sure I agree with the expectation. The sticky pos is laid out in the whole grid container, because its parent is a subgrid... Then again I guess the subgrid could be considered its own container too, for sticky pos purposes...

Ting-Yu, any strong opinions? Maybe we should fix bug 1679797 in some other way (like what I suggested in bug 1679797 comment 7 or so?).

Component: Site Reports → Layout: Grid
Flags: needinfo?(emilio) → needinfo?(aethanyc)
Product: Web Compatibility → Core
Summary: codepen.io - Scrolling the page shows different behavior compared to Chrome for sticky position elements → Sticky positioned element inside subgrid is contained to top level grid, not to subgrid box.
Webcompat Score: --- → 1

Is it the same reason for broken smooth scrolling or should i open a different bug report?

Re comment 5:

Then again I guess the subgrid could be considered its own container too, for sticky pos purposes...
Ting-Yu, any strong opinions? Maybe we should fix bug 1679797 in some other way (like what I suggested in bug 1679797 comment 7 or so?).

A subgrid is a grid container itself, so it seems reasonable for it to act as a containing block for sticky positioning purposes. Both Chrome and Safari have the same behavior, so we might want to consider switching our behavior to align with them, assuming it's not too difficult to implement.

Severity: -- → S3
Flags: needinfo?(aethanyc)

I've ran into this a few times when using subgrid as a page level macro grid for horizontal alignment. Something like this:

grid-template-columns:
  [fullbleed-start]
  20px
  [main-start column-1-start] 1fr [column-1-end] 10px
  [column-2-start] 1fr [column-2-end] 10px
  [column-3-start] 1fr [column-3-end] 10px
  [column-4-start] 1fr [column-4-end main-end]
  20px
  [fullbleed-end];

In order to align items horizontally, you need 'propagate' the subgrid down your tree like so:

grid-column: fullbleed; /* or any column */
display: grid;
grid-template-columns: subgrid;

I've been using this method to consistently align elements horizontally across entire pages. Currently there's no way to propagate the subgrid through a sticky element, since doing so would makes the sticky element align to the entire page (but only in firefox).

I think laying the sticky out on the parent grid could make sense if both the sticky and the subgrid were both affecting the same axis. When the two are in different directions though, like with a vertical sticky and horizontal columns, it doesn't make much sense to me.

Duplicate of this bug: 1987394

Instead, ensure we end up with a reasonable containing block reflow
input for subgrid to avoid regressing the parent.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Duplicate of this bug: 1999692
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/56027 for changes under testing/web-platform/tests
Whiteboard: [webcompat-source:web-bugs] → [webcompat-source:web-bugs], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Upstream PR merged by moz-wptsync-bot

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)
Flags: needinfo?(emilio)

firefox-beta Uplift Approval Request

  • User impact if declined: See blocked bug.
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: See duplicate bugs.
  • Risk associated with taking this patch: low
  • Explanation of risk level: Relatively straightforward fix.
  • String changes made/needed: None
  • Is Android affected?: yes
Attachment #9527579 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Instead, ensure we end up with a reasonable containing block reflow
input for subgrid to avoid regressing the parent.

Original Revision: https://phabricator.services.mozilla.com/D272370

Attachment #9527579 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [uplift] [qa-ver-needed-c147/b146]
QA Contact: gmoldovan
QA Contact: gmoldovan → pmagyari

Verified fixed using Nightly 147.0a1 (20251119095727) and Beta 146.0b5 (20251119090309) on Windows 10, MacOS 15.5 and Ubuntu 24.04.

Status: RESOLVED → VERIFIED
QA Whiteboard: [uplift] [qa-ver-needed-c147/b146] → [uplift] [qa-ver-done-c147/b146]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: