Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very strange iframe event behavior


This question has me completely stumped. Since it's in a browser extension, I can't post my code.

The issue is apparently that mouse events inside the iframe (hovering over a link, over text, selecting...) are off by about 200px, this includes right clicks as shown in this screenshot:

The red dot is the actual mouseclick location

The red dot is the actual mouseclick location. Again, since this is an extension (I'm actually doing the JS part in Tampermonkey, it's easier) I can't try it out in other browsers so it might just be chrome.

The iframe is to contain third-party dynamically loaded content so I can't use a div or other element. It's also reused and is dynamically inserted on load.

This also doesn't happen the first time content is inserted instead it takes a few "cycles" to appear.

Any ideas?

like image 747
A.M.K Avatar asked Jun 07 '26 01:06

A.M.K


1 Answers

This was apparently a Chrome bug, albeit a strange one. I started having other issues so I reinstalled Chrome and upgraded to Windows 8 (I was planning to anyway), the bug seems to have gone away.

EDIT: It just came back, it turns out that the issue was that I was using -webkit-transform: scale() to show and hide the frame with a transition, removing this fixes the issue.

So, to all those with iframe mouse event issues in Chrome/WebKit: check all of your transforms and any CSS3 effects, try removing them one at a time.

like image 75
A.M.K Avatar answered Jun 09 '26 15:06

A.M.K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!