Closed Bug 1492315 Opened 6 years ago Closed 4 years ago

table cells grow on resize when the table is a child of display grid

Categories

(Core :: Layout: Grid, defect, P3)

62 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: swalker, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: testcase, Whiteboard: [layout:backlog:quality], [wptsync upstream])

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0
Build ID: 20180830143136

Steps to reproduce:

In an HTML document, I have a table as a child of an element with display:grid. I tried on FF62 Mac and FF62 Win10 both with and without add-ons disabled. The HTML code is available on https://codepen.io/kamakalolii/pen/GXwYmm/?editors=1100


Actual results:

The table will not properly show any table CSS margins and the cells will grow vertically when the viewport is resized (in either X direction).


Expected results:

The margins should properly show and the table should not vertically resize.
Component: Untriaged → Layout: Grid
Product: Firefox → Core
Attached file Reduced testcase
It seems a non-zero margin on the table is required for the bug to appear.
Its height grows by that amount on each reflow for some reason.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
Blocks: 1521088
Depends on: 1527734

Similar behaviour is observed when display:table is assigned to a child within an element with display:grid. If child has some margin applied, it vertically grows by the margin amount whenever any DOM Manipulation occurs.
Can be reproduced at JSFiddle - https://jsfiddle.net/12tjpcx3/15/
Observed on FF 66/Win 7.

I can corroborate that having a table with a non-zero margin as a child of an element with display: grid causes the unexpected padding on table cells.

Remove either of these conditions and tables appear as normal; For now I am simply removing the margins around my tables.

Related: https://bugzilla.mozilla.org/show_bug.cgi?id=1427148

(Ah, sorry - it looks like Josh's testcase shows a version of this bug after all. I was over-pivoting on the width growing/shrinking in the testcase and didn't notice the subtle vertical margin change. I'll go ahead and mark comment 9 as obsolete.)

Here's a reduced version of Josh's testcase, comparing table-in-a-grid (left) vs. table-in-a-block (right): https://jsfiddle.net/dholbert/64ge85kd/

This is happening in https://drafts.csswg.org/css-align/#overview too for example.

Flags: needinfo?(emilio)

Also happening on https://w3c.github.io/ServiceWorker/#dom-serviceworkerregistration-onupdatefound when hovering the link "updatefound" per this Twitter thread: https://twitter.com/fantasai/status/1230029207591194624?s=20

Given the number of dupes, putting this as a candidate for our more near-term quality backlog.

Whiteboard: [layout:backlog:quality]

Otherwise we do the wrong thing for incremental layout.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Sorry, I just forgot about this.

Flags: needinfo?(emilio)
Attachment #9128322 - Attachment description: Bug 1492315 - Subtract table grid item margins earlier. r=mats → Bug 1492315 - Subtract table grid item margins correctly. r=mats
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d91c407d4ccc
Subtract table grid item margins correctly. r=mats
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21940 for changes under testing/web-platform/tests
Whiteboard: [layout:backlog:quality] → [layout:backlog:quality], [wptsync upstream]
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: