Open Bug 1691924 Opened 5 years ago Updated 5 years ago

Margin wrongly highlighted when transform rotate applied (Firefox Developer Tools)

Categories

(DevTools :: Inspector, defect, P3)

Firefox 85
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: cromodder, Unassigned)

Details

Attachments

(5 files)

Attached image highlight_bug.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36

Steps to reproduce:

Added margin and transform rotate on one element and tried highlighting it in Firefox Developer Tools.

Minimal setup where the bug can be reproduced: https://codesandbox.io/s/festive-galileo-16cr2?file=/index.html

Actual results:

Margin is correctly applied in the browser itself but it's wrongly highlighted in the Firefox Developer Tools.

Expected results:

It should highlight margin where it's actually applied.

Component: Untriaged → Inspector
Product: Firefox → DevTools

Thanks for filing a bug with a test case!

You are correct, we should not in theory apply the node transformation matrix to the margin highlighter.

But I think that highlighting the margin in the correct spot could also be confusing, as it might overlay the rest of the boxmodel, or feel totally disconnected from it.

Will add some examples.

Attached image marginleft_rotate45.png

Similar example as in the summary, just used a bigger margin, and switched to a rotate 45.

Attached image margin_rotate45.png

same example, but with margin on all sides

Attached image margin_translate_rotate

Last example, with an additional translate

Also a note on the implementation, the box-model highlighter relies on getBoxQuads({ region }) to retrieve the coordinates of the areas to highlight.

For transformed elements, getBoxQuads({ region: "margin" }) returns transformed coordinates. If we decide to change this, the actual change will probably need to happen in the getBoxQuads implementation.

Before going to that, I'm still not sure what is the best representation for the margin of a transformed element.
Martin: by any chance do you remember any prior discussion about this topic?

Flags: needinfo?(mbalfanz)
Attached image box+transform.png

I don't remember any prior discussion.

Looking at this, I agree that we should show the box-model highlighter in the correct position. I see your point that it can be confusing, but this is what we have a transform highlighter for. I wonder if we could show this by default for transformed elements?

Flags: needinfo?(mbalfanz)

Thanks for the feedback Martin!

I agree with your suggestion. If we can somehow always show the transform highlighter on top of the box-model highlighter for transformed elements, we could keep the margin at the right place. This should make it easy to understand for users.

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: