• 24
  • May, 05

Scrolling in Internet explorer causes elements to lose focus

Today I spent a few hours trying to debug a web app which uses an autosuggest similar to Google Suggest. I also had an “onBlur” on the text box that will hide the suggestions. Unlike Google Suggest, I could not limit the number of suggestions because it was suggesting names of people in the database and I can’t just list the first 10 or 15 “Johnson” names, I have to list them all. That “Johnson” list can get long enough to overflow off the page, causing a need to scroll down to see all results listed.

Although this wasn’t a problem in Firefox, Internet Explorer was causing the text box to lose focus and therefore hide suggestions whenever I clicked the scroll bar in order to view lower results. I tried Google’s page and shrunk my window enough that a scroll bar appeared, but Google’s suggestions weren’t dissapearing! What in the world is going on here? After searching through my code for something I might be doing that would cause it, I finally started just simply deleting elements from my page until it worked. It wasn’t until I deleted the Doc Type Declaration at the top of the page that it started working. I checked Google Suggest’s code, and sure enough, there is no DTD on that page.

Share and Enjoy:
  • Digg
  • Reddit
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Technorati
  • TwitThis
  • E-mail this story to a friend!

One Response

  1. If you just an onblur on your box to make it disappear when it loses focus, it is going to disappear whenever it loses focus. Period.

Leave a Reply

Car Humor | U2 News