Jump to content

Internet Explorer Focus Regain


jbattersby
 Share

Recommended Posts

Hi,

I've had a "bug" assigned to me today (which quite frankly, I think is a bit of an edge case but I need an answer to come back with..) in Internet Explorer.

To reproduce:

  1. Open any Phaser game in Internet Explorer
  2. Click the address bar
  3. Click the game

Outcome: game does not resume

Expected: game should resume

In other browsers the outcome is as expected but not in IE. If you click anywhere else on the page it does resume. I can only guess that for some reason the click event is not being bubbled back to the browser or because the game has lost focus it is not keeping away for input events? I tried to add an event listener to the canvas element after it had loaded but no luck.

Does anybody have any thoughts, suggestions?

Link to comment
Share on other sites

If anybody else comes across this, my solution was to create an invisible DOM element (DIV) superimposed over the canvas area whenever the game lost focus. I gave this element a mouse down event listener to un-pause the game, which in turn would call the onFocus method in Phaser. This onFocus method (which would also be called by clicking anywhere else within the browser) would then remove the element.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...