mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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 {
|
||||
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
|
||||
return <-u.loop(context)
|
||||
|
Loading…
Reference in New Issue
Block a user