New issue
Advanced search Search tips

Issue 3531 link

Starred by 33 users

Issue metadata

Status: Duplicate
Merged: issue 456
Owner: ----
Closed: Nov 2015
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Tabs can steal focus using alert/prompt/confirm popups

Reported by berendja...@gmail.com, Oct 17 2008

Issue description

Chrome Version       :  Official Build 2200 Mozilla/5.0 (Windows; U; 
Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) 
Chrome/0.2.149.30 Safari/525.13
URLs (if applicable) :
http://skypher.com/SkyLined/Repro/Chrome/tabs%20steal%20focus/repro.html
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
     Safari 3: NOT APPLICABLE
    Firefox 3: FAIL
         IE 7: OK

What steps will reproduce the problem?
1. Open a page in a new tab
2. Shift focus to another tab
3. Page in new tab executes an alert/confirm/prompt popup

What is the expected result?
Focus remains on current tab

What happens instead?
Focus shifts to tab that executes the alert/confirm/prompt popup



 

Comment 1 Deleted

Filed with mozilla as 460434:
https://bugzilla.mozilla.org/show_bug.cgi?id=460434

Comment 3 Deleted

Labels: -Area-Misc Area-BrowserBackend
interesting...

Opera is passing this test btw

Comment 5 Deleted

Comment 6 by beej...@gmail.com, May 19 2010

this can be especially bad if the alert was actually important or there could be fallout from the wrong reply to a 
choice it gives.  i was just typing a facebook message when an online banking-related tab stole my focus and my 
keystrokes did something to dismiss the alert before i even got to see it.  not good.

Comment 7 Deleted

 Issue 159329  is similar and will probably be resolved by the same fix.
 Issue 159329  has been merged into this issue.
There's a profound irony here. There's an API for web notifications:

https://developer.mozilla.org/en-US/docs/Web/API/notification

This requires permission from the page in question, which is denied by default. But it doesn't steal focus, and as far as I can tell, can't really do anything evil. Gmail does this for incoming emails, assuming it's granted permission.

On the other hand, all webpages are allowed to alert() with impunity. This steals focus, not just from other tabs, but from whole other applications, unless the window manager implements some sort of focus-stealing protection.

Comment 11 by mkte...@gmail.com, Sep 6 2014

Labels: Cr-UI-Browser-TabStrip
The alert in the repro link still prevents me from switching or closing tabs as of Chrome 38.0.2125.44 (Official Build 291484) beta-m, 64-bit, Windows 7.

Looks like Firefox fixed this in 2010; in v28 I can close or switch away from an alert-blocked tab:
https://bugzilla.mozilla.org/show_bug.cgi?id=59314
This also steals focus from other Chromium windows, even if they belong to a different profile.

This issue should be escalated to a security issue, as it provides a small denial-of-service vector on the client side towards the user without permission, breaking one of the basic security assumptions of web browsing: That each website should be isolated and self-contained and not be able to affect the user and system whatsoever, unless given explicit permission through some user action.
Current behavior in Firefox on Linux is:
1. Alerts activate a tab in the browser window switching away from any other tab.
2. Alerts do not activate a browser window (so work done in another window including another Firefox window is not interrupted)
3. It is possible to switch away from the alerting tab to another tab without dismissing the alert.
4. Input to other tabs is not blocked.
It's even worse in Chrome on Mac Yosemite, as the tab alerts steal focus even from other application windows.  Tabbing away from a page that does JavaScript validation on form fields onblur is especially annoying.
Mergedinto: 456
Status: Duplicate
Bug isn't fixed, focus is still stolen (although alert closes on tab switch).

Comment 17 by a...@chromium.org, Oct 13 2017

True. I'll be fixing this :)

Comment 18 by jpl...@gmail.com, Feb 11 2018

Maybe it is now solved. But I miss this 'feature'. I have a webapp that gives alerts when it needs my attention. It needs my attention, even when I'm on another tab.. Now I see a blue dot on the webapp-tab. But I easily overlook that. Is there a way to turn this feature (steal focus) on or off?
maybe look at using Notifications instead:
  https://developer.mozilla.org/en-US/docs/Web/API/notification
Tabs don't seem to steal focus anymore, but at least in MacOS, if the tab is selected and you are using another application, Chrome will steal focus from it. This is pretty annoying, especially when doing something like running Selenium tests with chromedriver when the test involves alerts.
In Chrome 67.0.3396.62 on Windows 7 x64, alerts and the onbeforeunload confirmation still steal focus from other tabs and apps. This bug breaks the Livereload web development workflow: if the an open tab with the project being worked on has an active beforeunload handler, Chrome steals focus from the IDE on every save.

Sign in to add a comment