using window.find fails to find multiple matches in textarea

NEW
Unassigned

Status

SeaMonkey
UI Design
14 years ago
10 years ago

People

(Reporter: Scott MacVicar, Unassigned)

Tracking

Trunk
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

508 bytes, text/html
Details
(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040822
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040822

The use of window.find fails to find multiple values in a textarea where using
Find in page from the Edit menu will.

See attached testcase.

Push button, the first entry of foo will be highlighted. Pressing multiple times
wont match the following entries. Using ctrl+f and searching for foo will find
all 3 entries.

Reproducible: Always
Steps to Reproduce:
(Reporter)

Comment 1

14 years ago
Created attachment 156805 [details]
testcase

Comment 2

14 years ago
Can you make it to work in IE?

I have debugged your testcase. What is happening in Mozilla is this: when you
click the button, it clears the selection -- this is reminiscent to what happens
when you click on the content window, any current selection is cleared on the
window. Therefore, the same (first) match is re-found again.
(Reporter)

Updated

14 years ago
Attachment #156805 - Attachment is obsolete: true
(Reporter)

Comment 3

14 years ago
Created attachment 156858 [details]
better testcase

better testcase.

the three instances of foo outside the textarea will be found with each button
press, it then hits the textarea and finds the first entry. It then doesn't
match any of the others after that and goes back to the start.

There isn't an IE behaviour since window.find isn't supported.

Comment 4

14 years ago
Is it an important problem for a real application that you have?
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 5

14 years ago
Yeah, we have a template editor that allows searching in IE using an IE specific
method.

bug 241053 fixed searching within textarea using the "Find in Page". I was under
the impression that window.find was the same system just with a scripted wrapper.

Comment 6

14 years ago
It is not a simple problem to fix in the back-end. The fact that the focus is
switching to the <button> element in the same page confuses the special
find-in-textarea.

As a work-around in your first example
http://bugzilla.mozilla.org/attachment.cgi?id=156805&action=view

you can change
<button onclick="doFind('foo');">Run Find</button>

to
<button onclick="document.getElementById('foo').focus();doFind('foo');">Run
Find</button>, 

then position the caret on the first character in the textarea before starting
to find.
Product: Core → Mozilla Application Suite
Filter "spam" on "guifeatures-nobody-20080610".
Assignee: guifeatures → nobody
QA Contact: guifeatures

Updated

10 years ago
Component: XP Apps: GUI Features → UI Design
You need to log in before you can comment on or make changes to this bug.