Skip to content

Commit 7e19f45

Browse files
committed
When the Game first boots it will now call window.focus(). This allows keyboard events to work properly in IE when the game is running inside an iframe. You can stop this from happening by setting window.PhaserGlobal.stopFocus = true (thanks @webholics phaserjs#1681)
1 parent ebdb6d0 commit 7e19f45

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ We've rolled our own fixes into our version of Pixi, ensuring we keep it as bug-
184184
* Text style has a new optional property: `backgroundColor` which is a Canvas fill style that is set behind all Text in the Text object. It allows you to set a background color without having to use an additional Graphics object.
185185
* The Physics Manager now has a new `reset` method which will reset the active physics systems. This is called automatically on a State swap (thanks @englercj #1691)
186186
* When a State is started and linked to Phaser it has a new property created on it: `key`, which is the string identifier used by the State.
187+
* When the Game first boots it will now call `window.focus()`. This allows keyboard events to work properly in IE when the game is running inside an iframe. You can stop this from happening by setting `window.PhaserGlobal.stopFocus = true` (thanks @webholics #1681)
187188

188189
### Bug Fixes
189190

src/core/Game.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,14 @@ Phaser.Game.prototype = {
578578

579579
this._kickstart = true;
580580

581+
if (window['focus'])
582+
{
583+
if (!window['PhaserGlobal'] || (window['PhaserGlobal'] && !window['PhaserGlobal'].stopFocus))
584+
{
585+
window.focus();
586+
}
587+
}
588+
581589
this.raf.start();
582590

583591
},

0 commit comments

Comments
 (0)