So I discovered this not-so-handy bug in Firefox today related to filling in information into a HTML form. Sometimes when the user is about to enter data, the text entry field’s cursor caret becomes invisible.

It’s a bug I’ve seen before but had just put down to my browser set-up, but today after seeing it happen on a colleague’s machine, I decided to investigate what was actually going on. It turns out I was not alone in having this problem, it is a known bug.

Where have you gone cursor?

Basically, the problem seems to be caused by the scrolling properties of the DIV elements that an input field is contained in. There’s no z-index or cursor CSS fix - instead you need to use one of the two following solutions.

  • Create a new DIV element to surround the input which has an overflow of hidden. E.g:
<div style="overflow:hidden"><input type="text" id="example" /></div>

(Inline style used for demonstration - use a style sheet if you can)

  • Set the CSS property position of the container DIV to fixed. E.g:
div.container { position:fixed }

So now your cursor problem is resolved.

Sure your layout’s probably screwed and needs some reworking, but at least the cursor blinks! In all seriousness, this is a decent enough workaround should you consider the problem one that has to be solved. The good news is that Firefox 3 no longer has this problem, so hopefully this is a soon to be outed gotcha.

Tags: , , , , , ,

4 Responses to “Firefox’s Disappearing Cursor”

  1. Interesting bug, I’m not sure I’ve encountered it. I have encountered the bug where certain inputs will fail to have spelling correction, and I believe it’s due to certain CSS properties. I haven’t experimented fully, but I have had a textarea lose the spell checking ability when certain styles were applied. Guess it could use more tinkering.

  2. I haven’t encountered that one myself, but I’ll keep an eye out for it and see if I can find an answer!

  3. FYI, it looks like this is fixed in Firefox 3.

  4. I’m having this problem with Firefox 3.

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>