hit testing on css transform behaves differently than Chrome
Categories
(Core :: Web Painting, defect)
Tracking
()
People
(Reporter: trusktr, Unassigned)
Details
(Keywords: parity-chrome)
Attachments
(1 file)
(deleted),
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Steps to reproduce:
Visit and see the demo in https://stackoverflow.com/questions/65694472 in desktop Firefox.
Actual results:
Ignore the description regarding what appears to be a Chrome bug. Firefox has a different issue.
Try to drag the cube to the around the grid. Try it multiple times (drag, let go, drag, let go, ...).
While you are dragging the cube, notice that you can not successfully move it into the top-right cell.
This is because the pointerover
event does not fire for that grid cell. That is grid cell 2 (zero-based, row-major order).
Also note if you move the cube to grid cell 4 (the middle cell), then you can not move the cube into cell 1 (top middle cell) or cell 2 (top right).
You can see in the console that there is no log output for the pointerover
events for those cells.
Expected results:
We should be able to move the cube to any grid cell; or basically the pointerover
event should fire for all cells.
I fixed the pointerover
issue in Chrome by not using pointerover
, so the demo works flawlessly in Chrome now.
https://codepen.io/trusktr/pen/eYdPOKb
It still doesn't work in Firefox. For some reason, the top-right area of the grid is numb to the pointermove events.
My guess is that CSS transforms are causing the hit testing to be wrong.
I've no idea actually.
This similar demo behaves very different between Chrome and Firefox:
https://codepen.io/trusktr/pen/oNzaMeY
In Chrome, the placement of the cube when you drag is always correct.
In Firefox, the cube does not always want to go where you drag it.
Comment 4•4 years ago
|
||
for me, although none of the cells except top right seem completely off-limits, when i try to move the cube east it always seems to struggle. like it won't jump to the next cell to the right, but it will jump 2 cells to the right and then back 1 cell to the left. really weird. moving the cube west never seems to fail for me, for what that's worth
Comment 5•4 years ago
|
||
Hello! I have managed to reproduce the issue using Firefox 86.0a1 (2021-01-18) on Ubuntu 20. I will add a component to this issue so one of our developers could look more into it. If it's not the right component please feel free to change it to an appropriate one.
Comment 6•4 years ago
|
||
No idea what is going on, but I don't see any transitions or animations in that demo. Moving to events for now. I did notice a lot of console errors though so that might be a good place to start.
Updated•4 years ago
|
Comment 7•4 years ago
|
||
This is not a pointer event issue, we don't even receive a mousemove event on the top-right area of the grid.
Comment 8•4 years ago
|
||
minimal reproducible test script.
Comment 9•4 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #8)
Created attachment 9198263 [details]
test.htmlminimal reproducible test script.
This is a similar setup as the test script in comment #1.
STR:
- load test script
- mouse moves on the green area that is overlapped with the red area.
Result in Firefox:
mousemove event is dispatched to the red content.
Result in Chrome:
mousemove event is dispatched to the green content.
But it seems our behavior makes more sense.
Updated•4 years ago
|
Comment 10•4 years ago
|
||
(Not sure if this is the right component for hit testing, feel free to send it back or move to the right component)
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Based on Edgars reduced testcase, this is a webcompat issue that we have seen before in bug 1517388.
The issue is that hit testing behavior is not properly defined for 3D transformed elements. There is an open issue filed against the spec here https://github.com/w3c/csswg-drafts/issues/3997
Reporter | ||
Comment 12•4 years ago
|
||
Thanks Edgar! I forgot about the transparent element I have in that example for the "camera" transform. I see how hovering on that transparent element blocks the pointer events from happening on the element underneath. It is easy to fix using pointer-events:none on that element.
Description
•