Skip to content

Commit

Permalink
uidriver/js: Stop auto-focusing on loading when the page is in an iframe
Browse files Browse the repository at this point in the history
Fixes #1373
  • Loading branch information
hajimehoshi committed Oct 10, 2020
1 parent 10f394f commit 7f55fdf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/uidriver/js/ui_js.go
Expand Up @@ -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)
Expand Down

0 comments on commit 7f55fdf

Please sign in to comment.