Open Bug 537619 Opened 15 years ago Updated 2 years ago

consistency of onBlur and onFocus events (+multitab browsing)

Categories

(Core :: DOM: Navigation, defect)

x86
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: estellnb, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.6) Gecko/20091201 SUSE/3.5.6-1.1.1 Firefox/3.5.6 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.6) Gecko/20091201 SUSE/3.5.6-1.1.1 Firefox/3.5.6 The maps provided at http://www.elstel.com/SeaLevelRise.html#Maps or http://www.elstel.com/Meeresspiegel.html respectively have a size load and store feature which works quite well when it comes to switch between different tabs. If I leave the window the onBlur event is correctly executed. However if I focus the window again a respective onFocus event is missing so that the tab size is not restored. In this example onBlur and onFocus should only be executed on tabbing not on entering/leaving the browser window. To make such a behaviour possible I have the following proposal: Provide onFocus(e) - e.fromTab, e.toTab event properties to indicate on from which to which tab the focus is changed. A deluxe tab handling could even provide an array as tabulators[e.fromTab].document.location.href. If the window is focused e.fromTab should be zeroed. If the user changes to another window e.toTab should be zero. That way javascript could even detect if a target=_blank link has been opened in a new window or a new tab: new window: e.fromTab=0, e.toTab/document.tab=1. I would personally also welcome target=_tab and target=_window/popup html anchor options. Reproducible: Always
Component: Tabbed Browser → Document Navigation
Product: Firefox → Core
QA Contact: tabbed.browser → docshell
> That way javascript could even detect if a target=_blank link has been opened > in a new window or a new tab This is explicitly NOT desirable. That's none of the javascript's business. Smaug, Neil, any idea why there is no focus event when re-focusing the content in this case?
> That way javascript could even detect if a target=_blank link has been opened > in a new window or a new tab This is badly desireable!! How else should my picture viewer know whether to resize the window to fit the image or whether to leave things as they are since it is just opened into one of many tabs.
> whether to resize the window to fit the image Don't ever resize the viewer's windows, period. It's a pretty rude thing to do.
And in particular, your assumption that viewing areas are either tabs or windows is completely bogus; in Fennec's case they're not really either and any code that assumes they're one or the other would completely fail. So please, just stop trying to mess with the user-interface part of the browser from inside the content. The focus issue you report, on the other hand, sounds like a real problem that we need to fix.
> Don't ever resize the viewer's windows: This is almost a necessity for popup windows! They may either be much too large or too small. A popup window should not require more space than necessary!
> your assumption that viewing areas are either tabs or > windows is completely bogus I have never seen a window which had something that is 'in between' a tab and a new window. What a queer argument.
How would I reproduce this bug? What should I be looking for?
I have recently changed the page to hide the bug. At http://www.elstel.com/sealevel/SeaLevelRise2.html#Maps I have restored the old behaviour for means of testing. Open a Map, focus the tab. Then click on another window (old size restored) and click back on Firefox again - the window should now have the same size as before. Besides this it is a more basic question whether we should simply forbid resizing on multitabbed browsing or whether we should implement event.fromTab and event.toTab as suggested in Comment #1. Control over tabbed browsing could f.i. make an app fit the content to the window instead of fitting the window to the content.
When I view that page, I get a focus event on the document just fine. The window size only changes when blurring. Perhaps you have something other than the content focused when you switch windows. For instance, if the url field is focused, the content will not receive any blur or focus events when switching between windows.
When viewing one of the maps the window size should be changed back onBlur and restored onFocus. Currently it is only changed back onBlur but not restored onFocus.
I understand that. But the blur and focus events are firing just as they should.
If onFocus fires as soon as you click back on the Firefox window then this has already been fixed with the Ff. version you are using. Let us nonetheless think about a mechanism to check whether more than one tab is currently open (no resizing should then take place).
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.