WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
33389
window.focus() should be disabled when not user-initiated
https://bugs.webkit.org/show_bug.cgi?id=33389
Summary
window.focus() should be disabled when not user-initiated
Steve Block
Reported
2010-01-08 09:37:13 PST
Currently, window.focus can be used to shift the focus to another tab or window, even if this is not user-initiated. This can cause a jarring user experience so should be disallowed. Note that Firefox disables window.focus() when called from a page's onload handler.
Attachments
Attempt at a patch
(1.40 KB, patch)
2010-08-16 14:14 PDT
,
Jay Civelli
sam
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Steve Block
Comment 1
2010-01-08 09:41:22 PST
The fix for this will require the ResourceRequest 'userGesture' flag being added in
Bug 33381
Sam Weinig
Comment 2
2010-01-10 13:48:49 PST
(In reply to
comment #1
)
> The fix for this will require the ResourceRequest 'userGesture' flag being > added in
Bug 33381
Why is that? Could't we just query whether a userGesture (ala popup detection) was taking place when calling window.focus()?
Jay Civelli
Comment 3
2010-08-16 14:14:19 PDT
Created
attachment 64522
[details]
Attempt at a patch
Sam Weinig
Comment 4
2010-08-16 23:41:50 PDT
Comment on
attachment 64522
[details]
Attempt at a patch This needs tests. r-.
Jay Civelli
Comment 5
2010-08-17 00:22:14 PDT
I was not sure on how to simulate user gesture in a layout test. The LayoutTestController does not seem to have anything to that effect. Do you have any pointers?
Alexey Proskuryakov
Comment 6
2010-08-17 03:14:03 PDT
In most cases, one can simulate a user gesture with eventSender. For this to go in, we'd need a more extensive research of compatibility issues. Per the description, the proposed behavior doesn't even match Firefox. Are we sure that focusing windows outside of a user gesture is never good?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug