Bug 175893. Make XUL Tabs focusable -- reopened because when switching tabs we were scrolling to the remembered focus instead of remaining at the last position. r=mconnor, sr=neil

git-svn-id: svn://10.0.0.236/trunk@159652 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronleventhal%moonset.net
2004-07-22 13:37:07 +00:00
parent 7be83995ed
commit 9b5549fac3
2 changed files with 13 additions and 6 deletions

View File

@@ -492,8 +492,11 @@
}
}
function setFocus(element) {
Components.lookupMethod(element, "focus").call(element);
if (document.commandDispatcher.focusedElement &&
document.commandDispatcher.focusedElement.parentNode ==
this.mCurrentTab.parentNode) {
// The focus is on a tab in the same tab panel
return; // If focus was on a tab, switching tabs focuses the new tab
}
var whatToFocus = window.content;
@@ -510,10 +513,14 @@
whatToFocus = newBrowser.focusedWindow;
}
document.commandDispatcher.suppressFocusScroll = true;
function setFocus(element) {
document.commandDispatcher.suppressFocusScroll = true;
Components.lookupMethod(element, "focus").call(element);
document.commandDispatcher.suppressFocusScroll = false;
}
// Use setTimeout to avoid focus outline ghosting.
setTimeout(setFocus, 0, whatToFocus);
document.commandDispatcher.suppressFocusScroll = false;
]]>
</body>
</method>

View File

@@ -583,13 +583,13 @@
}
function setFocus(element) {
document.commandDispatcher.suppressFocusScroll = true;
Components.lookupMethod(element, "focus").call(element);
document.commandDispatcher.suppressFocusScroll = false;
}
document.commandDispatcher.suppressFocusScroll = true;
// Use setTimeout to avoid focus outline ghosting.
setTimeout(setFocus, 0, whatToFocus);
document.commandDispatcher.suppressFocusScroll = false;
]]>
</body>
</method>