Closed Bug 305939 Opened 19 years ago Closed 18 years ago

Focus lost when key pressed before page load in newly loading foreground tab

Categories

(Firefox :: Keyboard Navigation, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: aaronlev, Assigned: oliver_yeoh)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(1 file)

Spinnoff from bug 249136 comment 84 STEPS TO REPRODUCE (from Mats') 1. start Firefox and set pref "select new tab opened from links" on 2. load http://plugindoc.mozdev.org/faqs/ 3. middle-click the last link on the page: "Embedded Windows Media in Firefox 1.0" (which links to http://forums.mozillazine.org/ which is really slow) 4. press the DOWN key as soon as the new tab opens before the page is loaded. 5. wait for the page to load 6. press DOWN -- it does not work until you click on the page background. If you skip step 4 then it works as expected. This is different from bug 249136, because if you wait for the page to load, the scroll keys work now.
Depends on: 249136
*** Bug 306062 has been marked as a duplicate of this bug. ***
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051003 (No IDN) Firefox/1.4.1 WFM now
I can still reproduce this using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051007 Firefox/1.4.1.
It seems I can reproduce it too. I was wrong in previous comment
No longer depends on: 249136
*** Bug 307806 has been marked as a duplicate of this bug. ***
Attached patch Possible patch (deleted) — Splinter Review
Taking a stab at this. So the problem here is that when the pres shell is unable to process the keystroke event (due to lack of frame or zombie document), the focus is shifted to the main firefox window during RetargetEventToParent. Patching RetargetEventToParent here so that it passes the parent's root view to the parent's event handler. This eliminates the need to shift the focus about before forwarding the event to the parent shell. AFAICT, this does not regress bug 249136 and bug 303260. This also fixes bug 324349. That bug should be duped or marked depends or something.
Attachment #239061 - Flags: superreview?(dbaron)
Attachment #239061 - Flags: review?(aaronleventhal)
Comment on attachment 239061 [details] [diff] [review] Possible patch Redirecting r= request to Mats Palmgren who now owns focus issues.
Attachment #239061 - Flags: review?(aaronleventhal) → review?(mats.palmgren)
Any chance of some reviews soon? Would like to get this while the problem is still fresh in my mind. Sorry for bugspam.
Assignee: nobody → oliver_yeoh
Blocks: 324349
Comment on attachment 239061 [details] [diff] [review] Possible patch >+ // Fake the event as though its from the parent pres shell's root view. s/its/it's/ Looks good otherwise. Tested on Mac/Windows/Linux. Boris knows that zombie stuff better than I do though. r=mats
Attachment #239061 - Flags: superreview?(dbaron)
Attachment #239061 - Flags: superreview?(bzbarsky)
Attachment #239061 - Flags: review?(mats.palmgren)
Attachment #239061 - Flags: review+
(In reply to comment #9) Great. Er, about the zombie stuff.. do you think we should limit the retargetting to NS_KEY events only? I can't think of any use case for retargetting the NS_CONTEXTMENU_KEY and IME events. Perhaps something like this? if (!mCurrentEventContent || InZombieDocument(mCurrentEventContent)) { - return RetargetEventToParent(aView, aEvent, aEventStatus, - mCurrentEventContent); + if (NS_IS_KEY_EVENT(aEvent)) { + rv = RetargetEventToParent(aEvent, aEventStatus); + } + PopCurrentEventInfo(); + return rv; }
(In reply to comment #10) > I can't think of any use case for > retargetting the NS_CONTEXTMENU_KEY and IME events. Neither do I, but OTOH I don't see the harm in leaving it as is either.
Comment on attachment 239061 [details] [diff] [review] Possible patch >Index: mozilla/layout/base/nsPresShell.cpp >+ // Fake the event as though its from the parent pres shell's root view. s/its/it's/ With that, sr=bzbarsky. This looks great! Sorry for the really slow review. :(
Attachment #239061 - Flags: superreview?(bzbarsky) → superreview+
Checked in, with the comment tweak. Thanks again!
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: