Friday, October 24, 2008

Missing Cursor in Input Field in Modal Layer (FireFox)

Ajax Modal Pains in Firefox! (spelling intentional)

I came across this problem at my previous employer, American Well. It was the first place I worked at where they were making heavy use of Ajax. They were big fans of the DoJo Toolkit, particularly the dijit widgets that DoJo offers. Throughout the application there are a large number of interstitial forms that were presented in Ajax Modal Panes. You know, those modal layers that aren't popups that pop new windows, but rather a new layer. Well anyway, whenever we had one of those modal layers with a form element in it (typically <input>), the cursor would not appear inside the field.

It was a small company, and whenever something was a pixel off, or didn't look quite as it should, they would come to me. Well, thanks to some Google searching I found out that there was nothing wrong with our code.

It turns out it is a well documented bug in FireFox:

Great! I'm not crazy. I found the solution that worked for me at the bottom of page one of this message board:

I tried the simplest fix which was to wrap the <input> elements in a <div> and apply the following styles to that <div>:

{
  overflow:auto
  }

I may have also set { position: fixed; }. I can't remember.

No comments: