Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workaround for iframe/mousewheel bug in Safari 6.1/7.0

I've found a bug affecting Safari 6.1 and 7.0 (it is fine in Safari 5.1 and 6.0). I've reported it to Apple.

The test case is here: http://tremby.net/dump/iframe-safari/

The code is very simple. The parent page just has an iframe, and the iframe has a listener for the mousewheel event which fires an alert. The iframe's contents are smaller than the iframe itself (more on that later).

If you refresh this page by clicking in the location bar and pressing enter, the mousewheel events in the iframe will not fire (you see no alerts). But if you refresh with the refresh button they will.

What I need is a workaround to this.

One we have already found is to make the iframe's contents overflow the iframe's bounds. Mousewheel events now fire, but it's not acceptable to have a scrollbar and the contents moving. (Never mind why the choice of using an iframe at all -- that's not up to me.)

Any ideas?

like image 319
tremby Avatar asked Jul 08 '14 21:07

tremby


1 Answers

Unbelievably this feature is still present in Safari 8.

I found great workaround here: https://bugs.webkit.org/show_bug.cgi?id=124139

Simply add onmousewheel="" attribute to the iframe tag.

<iframe src="..." onmousewheel=""></iframe>
like image 171
daniel.sedlacek Avatar answered Sep 29 '22 02:09

daniel.sedlacek