From 4e12e46b69c1b8fd584f35cc7b8104a15ba97926 Mon Sep 17 00:00:00 2001 From: "masayuki%d-toybox.com" Date: Thu, 25 Aug 2005 03:31:22 +0000 Subject: [PATCH] Bug 305342 regression: tabbing from links doens't work in FAYT mode r=mconnor git-svn-id: svn://10.0.0.236/trunk@178898 18797224-902f-48f8-a5cc-f745e15eee43 --- .../typeaheadfind/content/findBar.js | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/mozilla/toolkit/components/typeaheadfind/content/findBar.js b/mozilla/toolkit/components/typeaheadfind/content/findBar.js index 6af95052ae2..90340c60ad3 100755 --- a/mozilla/toolkit/components/typeaheadfind/content/findBar.js +++ b/mozilla/toolkit/components/typeaheadfind/content/findBar.js @@ -372,6 +372,20 @@ function setFoundLink(foundLink) gFoundLink = foundLink; } +function finishFAYT(aKeypressEvent) +{ + if (!gFoundLink) + return false; + + gFoundLink.focus(); // In this function, gFoundLink is set null. + + if (aKeypressEvent) + aKeypressEvent.preventDefault(); + + closeFindBar(); + return true; +} + function delayedCloseFindBar() { var findField = document.getElementById("find-field"); @@ -516,13 +530,21 @@ function onFindBarKeyPress(evt) else { if (gFoundLink) { var tmpLink = gFoundLink; - tmpLink.focus(); // In this function, gFoundLink is set null. - fireKeypressEvent(tmpLink, evt); - evt.preventDefault(); - closeFindBar(); + if (finishFAYT(evt)) + fireKeypressEvent(tmpLink, evt); } } } + else if (evt.keyCode == KeyEvent.DOM_VK_TAB) { + var shouldHandle = !evt.altKey && !evt.ctrlKey && !evt.metaKey; + if (shouldHandle && gFindMode != FIND_NORMAL && + gFoundLink && finishFAYT(evt)) { + if (evt.shiftKey) + document.commandDispatcher.rewindFocus(); + else + document.commandDispatcher.advanceFocus(); + } + } else if (evt.keyCode == KeyEvent.DOM_VK_ESCAPE) { closeFindBar(); evt.preventDefault();