Closed Bug 922040 Opened 11 years ago Closed 11 years ago

Find Toolbar Next button fails to select next occurrence for the first try

Categories

(Toolkit :: Find Toolbar, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 928619
Tracking Status
firefox24 --- unaffected
firefox25 --- unaffected
firefox26 --- fixed
firefox27 + fixed
firefox-esr17 --- unaffected
firefox-esr24 --- unaffected

People

(Reporter: andrei, Unassigned)

References

Details

(Whiteboard: [mozmill])

Steps:

1) Open "https://mozqa.com/data/firefox/layout/mozilla.html"
2) Open the Find Toolbar: Ctrl/Cmd + F
3) Type "community"
4) The first item should be highlighted
5) Click on the Next button

Expected results:
- the next occurrence should be highlighted

Actual results:
- the same (first) occurrence is still highlighted

Only affectes the first try, and only by using the mouse to interact with the Next button.
Pressing Enter to select the next occurrence works fine.

This reproduces on Nightly and Aurora, Windows and Linux
It works as expected on OSX

I will have a regression range shortly.
Whiteboard: [mozmill]
This has regressed in mozilla-central between the 13th and the 14th September.

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b9029b1de410&tochange=53d5e43e23cc

Will see if I can further narrow it down
The changeset responsible for the regression is http://hg.mozilla.org/integration/mozilla-inbound/rev/3734bebc9bfb

Tom, Mike could you please look into this?
Flags: needinfo?(mdeboer)
Flags: needinfo?(evilpies)
Weird, I will take a look.
Blocks: 666816
Flags: needinfo?(evilpies)
I can reproduce this, but the reason for this are still a mystery to me. I added some logging and everything looks quite reasonable:


// Entering Community:
fastFind: C
fastFind: Co
fastFind: Com
fastFind: Comm
fastFind: Commu
fastFind: Commun
fastFind: Communi
fastFind: Communit
fastFind: Community
// Pressing the next arrow
// This is some logging I added to "onFindAgainCommand"
findString: Community
findFieldValue: Community
searchString:Community
//
findAgain: false
When you click the button, the content window is losing focus (or something) which is causing either the cursor or the current match selection to be reset somehow. Since it actually has no current match at the time it is calculating "the next match", it goes to the match that was already selected because that is in fact the next match.

To see what I mean, just change onFindAgainCommand() to a dummy function or have it return right at the top so it does nothing: when you click the next button, there will be no current match (when you hit F3 the match will stay as expected, since nothing will be done in this case). This didn't happen before.
From what I can tell, the culprit seems to be the "blur" handler in the findbar textfield (a/toolkit/content/widgets/findbar.xml line 106), which by calling focus() on the window content seems to remove the current match selection.

My testing was very simple, I added a listener to the findbar textfield:

> bar._findField.addEventListener('blur', cancelBlur, true);

where cancelBlur:
> function(e) {
> 	if(testBlur) return;
> 	testBlur = true;
> 	e.preventDefault();
> 	e.stopPropagation();
> 	//bar.browser.finder.focusContent();
> 	testBlur = false;
> }

Inside cancelBlur(e) I preventDefault() and stopPropagation() the event (so it doesn't reach the textfield's own blur handler). Everything seems to work fine this way when I click the next button. But by adding the extra finder.focusContent() call, the original behavior happens again. testBlur is an outside variable, its checks are only so my handler doesn't also cancel its own call to finder.focusContent() which produces its own blur event in the textfield.
Bug 916536 should address this for 26.
Flags: needinfo?(mdeboer)
I can confirm that 26 is now unaffected.
Depends on: 921308
Bug 928619 should have fixed this. The patch is also on Aurora now. Can somebody verify?
Verified working in latest Nightly. The latest Aurora build still doesn't have the patch yet apparently, but I'll try it again when it updates.
Also confirmed working in Aurora now.
Thanks!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Marking status-firefox27 as fixed given this is resolved by https://bugzilla.mozilla.org/show_bug.cgi?id=928619
You need to log in before you can comment on or make changes to this bug.