views:

327

answers:

3

Open the following HTML snippet in IE (6 or 7) as HTML document. Ctrl+F and look for "test". IE never finds if the search term "test" which happens to be in the hidden textarea.

<html> 
<body> 
    <table> 
        <tr> 
            <td style="display:none;"> 
                <textarea >test</textarea>  -- first hidden 'test' is here
            </td> 
        </tr> 
    </table> 
    test  -- Second 'test' is here
</body> 
</html>

am I missing something trivial here?

A: 

Try visibility hidden or using absolute positioning and/or removing and replacing the textarea from one part of the body to another element to hide the textarea. But I have to ask why you would want something to be found if it's set to display:none.

apphacker
I did try visibility hidden. It doesn't help. In our web application, we have couple of textareas which are hidden , If user happens to search a word which is in the hidden textarea, IE never finds it even if it exists beyond that.
Chandra
+1  A: 

Gotta agree with apphacker on questioning the need. IE's behavior sounds right - why would you expect the browser to return a result when it couldn't show that result even if it were 'findable'?

I'd reassess the UI you're doing - look at the result you need rather than this particular implementation. Some JavaScript might come in handy.

fig
Dave,Probably I didn't put the question right. If you note in the above HTML snippet,"test" appears twice as part of text and textarea. IE doesn't find second "test" if the first element seems to be hidden textarea element. IE find focus is just lost. You may need to try what i mean
Chandra
Ah, didn't catch that second one, all tucked away down there. I pulled it up in IE7 and although clicking 'Next' didn't find it, clicking 'Previous' did find it. Didn't set a doctype, though, not sure if that might be a factor too.
fig
If you add 'test' before hidden textarea , it will find but it will never find something after hidden textarea. Pretty strange!!! I did try with doctype. Not any help.
Chandra
Yeah, pretty bizarre - it does look like you discovered a bug. They'll have to name it after you now!
fig
A: 

Chandra - nice bug! you are correct, IE should find the other visible "test" values without issue, but can not.

I noticed in IE7, if you search backwards (e.g. Previous) it does find them.

Addendum: It appears with IE8's inline search that they have fixed this issue now.

scunliffe
Thats true. Infact it finds all the "test" terms until hidden textarea. It is lost after it finds match in hidden textarea :( . Quite surprised not much references about this bug over the web
Chandra