Closed Bug 1841627 Opened 11 months ago Closed 11 months ago

Properties `inset` and `left` with `right` have bug

Categories

(Core :: Layout, defect)

Firefox 114
defect

Tracking

()

RESOLVED DUPLICATE of bug 1740580

People

(Reporter: phpcoder2022, Unassigned)

Details

Attachments

(1 file)

Attached file inset-bug.html

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0

Steps to reproduce:

Hello. Properties inset and left with right have bug. Button element with position: absolute not fit to parent size although pseudoelements work normal. Only property width rescue. All works normal in Chromium.

Moving this to Core > Layout component, to allow our engineers to examine it more closely. If this is not the right component, please move it to a more appropriate one. Thanks!

Component: Untriaged → Layout
Product: Firefox → Core

STR to trigger the issue:

  1. Hover any of the top three cards in the reporter's attached testcase.

EXPECTED RESULTS:
Card changes color.

ACTUAL RESULTS:
Card doesn't change color.

The testcase here is using an absolutely positioned <button> element with left:0 and right:0, and it's essentially testing "What does it mean for an absolutely positioned element to have left:0; right:0; width: auto.

Firefox is following the rules for replaced elements (like <img>) which resolve the width:auto to the image's intrinsic width (possibly adjusted if it's got an explicit height and an intrinsic aspect ratio).

Other browsers do seem to treat form fields using the non-replaced approach (like ::before and div, though). Form fields are notoriously in a bit of a "gray area" regarding whether they behave as replaced elements or non-replaced elements. But maybe we need to align with other browsers for interop here.

Reporter: if you're looking to work around this issue in a production website, you might have some success by using a div instead of a button; or, you could wrap your button in a div and have the div be the absolutely-positioned-thing with left:0;right:0, and make your button fill the div by giving it width:100%; height: 100%; box-sizing: border-box or other techniques.

Ah, this is essentially the same issue that's already covered by bug 1740580. We are indeed wrong here, based on the spec resolution referenced there (and issue is specific to buttons and other form-components, which we're sizing intrinsically like img elements with image data, when we should be sizing them with "stretch" behavior like divs and other elements).

Status: UNCONFIRMED → RESOLVED
Closed: 11 months ago
Duplicate of bug: 1740580
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: