Closed
Bug 822068
Opened 12 years ago
Closed 12 years ago
The content loses focus after calling gBrowser.moveTabBackward/moveTabForward
Categories
(Firefox :: Tabbed Browser, defect)
Firefox
Tabbed Browser
Tracking
()
RESOLVED
FIXED
Firefox 20
People
(Reporter: tabutils+bugzilla, Assigned: tabutils+bugzilla)
References
Details
Attachments
(1 file, 1 obsolete file)
4.56 KB,
patch
|
Details | Diff | Splinter Review |
this.mCurrentTab.focus() should not be called directly in gBrowser.moveTabBackward/moveTabForward.
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/tabbrowser.xml#2248
Attachment #692677 -
Flags: review?(dao)
OS: Windows 7 → All
Hardware: x86_64 → All
Summary: The tab element is focused after calling gBrowser.moveTabBackward/moveTabForward → The content loses focus after calling gBrowser.moveTabBackward/moveTabForward
Comment 2•12 years ago
|
||
Comment on attachment 692677 [details] [diff] [review]
patch
>+ let wasFocused = false;
>+ try {
>+ wasFocused = (document.commandDispatcher.focusedElement == this.mCurrentTab);
>+ } catch (e) {}
> this.mCurrentTab._selected = false;
Use document.activeElement and add a blank line after your code.
> // use .item() instead of [] because dragging to the end of the strip goes out of
> // bounds: .item() returns null (so it acts like appendChild), but [] throws
> this.tabContainer.insertBefore(aTab, this.tabs.item(aIndex));
>
> for (let i = 0; i < this.tabs.length; i++) {
> this.tabs[i]._tPos = i;
> this.tabs[i]._selected = false;
> }
> this.mCurrentTab._selected = true;
>+ if (wasFocused)
>+ this.mCurrentTab.focus();
Add a blank line before your code.
> this.tabContainer._handleTabSelect(false);
>-
> if (aTab.pinned)
> this.tabContainer._positionPinnedTabs();
Avoid this change.
r=me with these things addressed
Attachment #692677 -
Flags: review?(dao) → review+
(In reply to Dão Gottwald [:dao] from comment #2)
>
> >+ let wasFocused = false;
> >+ try {
> >+ wasFocused = (document.commandDispatcher.focusedElement == this.mCurrentTab);
> >+ } catch (e) {}
> > this.mCurrentTab._selected = false;
>
> Use document.activeElement and add a blank line after your code.
Is there any difference here? I read that there're several instances using document.commandDispatcher.focusedElement in tabbox.xml, so I copied it here.
And If I use document.activeElement, I assume try ... catch is no more needed?
Comment 4•12 years ago
|
||
Yes, try/catch isn't needed. document.activeElement is the standard way to do this. document.commandDispatcher.focusedElement is a proprietary Mozilla thing that you may need when dealing with anonymous content, which isn't the case here.
Attachment #692677 -
Attachment is obsolete: true
Keywords: checkin-needed
Comment 6•12 years ago
|
||
Assignee: nobody → ithinc
Keywords: checkin-needed
Comment 7•12 years ago
|
||
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
You need to log in
before you can comment on or make changes to this bug.
Description
•