mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
uidriver/js: Stop auto-focusing on loading when the page is in an iframe
Fixes #1373
This commit is contained in:
parent
10f394f72b
commit
7f55fdf769
@ -404,7 +404,12 @@ func init() {
|
|||||||
|
|
||||||
func (u *UserInterface) Run(context driver.UIContext) error {
|
func (u *UserInterface) Run(context driver.UIContext) error {
|
||||||
if u.initFocused {
|
if u.initFocused {
|
||||||
canvas.Call("focus")
|
// Do not focus the canvas when the current document is in an iframe.
|
||||||
|
// Otherwise, the parent page tries to focus the iframe on every loading, which is annoying (#1373).
|
||||||
|
isInIframe := !jsutil.Equal(window.Get("location"), window.Get("parent").Get("location"))
|
||||||
|
if !isInIframe {
|
||||||
|
canvas.Call("focus")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
u.running = true
|
u.running = true
|
||||||
return <-u.loop(context)
|
return <-u.loop(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user