RESOLVED INVALID Bug 5394
body onBlur="window.focus()" breaks window focus
https://bugs.webkit.org/show_bug.cgi?id=5394
Summary body onBlur="window.focus()" breaks window focus
Andre-John Mas
Reported 2005-10-15 22:46:13 PDT
If I defined a body tag as follows: <body onBlur="window.focus()"> then in Firefox and Opera the window will stay in front whenever I attempt to click on another web browser Window. This is not the case in Safari. In Safari the window will stay in front when I first click in another browser window, but subsequent clicks fail to keep the window in front, yet the window which is now in front does not allow user interaction. I believe this is WebKit related.
Attachments
Test case HTML file (168 bytes, text/html)
2005-10-16 00:43 PDT, Daniel Udey
no flags
Daniel Udey
Comment 1 2005-10-16 00:43:11 PDT
Created attachment 4368 [details] Test case HTML file This is a very simple HTML file that reproduces this bug. To use, open two windows in Safari or Shiira (or possibly other Webkit browsers). Move the two windows so that both can be seen but overlap, then drag this file onto the top window. It should display "Test". Once it loads, click on the background window. It should jump to the front momentarily, and then the other window will come to the foreground again. Clicking on the background window will bring it to the front, and if a site with input controls is in the background window, you will be able to click on them (they will gain the blue outline of an active control), but any typing you do will be sent to the 'Test' window regardless. Cmd-~ will not work to switch between windows either, and in order to restore proper behaviour, the 'Test' window must be closed (Cmd-W accomplishes this, since the 'Test' window always has focus).
Alexey Proskuryakov
Comment 2 2006-05-22 05:36:59 PDT
WinIE behavior looks random - sometimes, the window manages to regain the focus, other times, it cannot, and just starts flashing in the taskbar.
Ahmad Saleem
Comment 3 2022-09-01 09:15:46 PDT
ap@webkit.org - Can you guide me on how to test this? Thanks!
Alexey Proskuryakov
Comment 4 2022-09-01 11:48:53 PDT
The behavior appears to be identical in all browsers now, which is that a window cannot bring itself to front with focus(). This behavior isn't what was requested here, but it's uniform across all browsers and user friendly - webpages shouldn't be able to prevent switching to other webpages.
Note You need to log in before you can comment on or make changes to this bug.