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

This commit is contained in:
aaronleventhal%moonset.net 2007-08-22 04:59:30 +00:00
Родитель 4ecb86a407
Коммит 9ecaee4cd6
1 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -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>