A windsurfing, CSS-grudging, IE-hating, web-developing, gigantic-machine-puzzling blog

IE11 Select Box Bug Crashes Browser

Try to set the selectbox size = 1 with an onchange event & this is what happens...

Try to set selectbox size = 1 with an onchange event with IE11 & this is what happens…

Woke up this morning to 20+ emails from people trying to use CarComplaints.com. When they clicked on select boxes on our forms, their browser crashed. It was only happening to Internet Explorer 11 users.

Usually as a web developer, I can’t crash browsers. That is, not unless I get special help from bad Microsoft code.

Didn’t take long to find the problem. By “problem”, I mean the perfectly valid Javascript code that causes IE11 to crash, instantly & every time.

We use select boxes with the “size” attribute set to show more than one choice. We have an “onchange” event that sets the select box size back to 1 when the user picks an option. That’s what caused IE11 to self destruct. It has worked great all the way back to the medieval days of the web.

Here’s a JSFiddle that demonstrates the problem. Doesn’t take much.

UPDATE: A possibly better workaround using onclick() is described at the end of this post.

A temporary workaround I found was to put the “selectbox.size = 1;” code into a setTimeout(….) with anything small for the timeout — I used 10ms:

setTimeout("selectbox.size = 1;",10);

Apparently we’re not the only ones that ran into this — The Cape Cod Times has a web page about what sounds to me like the same IE11 select box bug.

I posted a bug report on the IE dev site but then found this bug had already been reported, although the author used “combobox” in the title which isn’t really accurate.

Also looks like this isn’t the first IE11 select box bug

UPDATE 1/1/14: A user responding to my post about this bug on the IE Dev forum pointed out that using the onclick event rather than onchange makes IE11 happy. The switch to .bind(‘click keyup’) worked great for our use case but may not be a universal fix for everyone.

Previous

Electrified Raccoon-Proof Bird Feeder

Next

Onepass United MileagePlus Expired Miles Are A Scam

3 Comments

  1. Anthony

    Thanks, both workarounds work great.
    it was working on previous versions of IE, and made me crazy when i saw my page crashing around without apparent [logical] reasons …. 😉
    Damned M$, how many years to correct a bug…?

  2. Hong Lily Ju

    I had the same problem, IE11 crashed on my dropdown select boxes sporadically. In my case, a dropdown select box can’t be the only item in an html table, it must stay with other elements like multiple or multiple . I don’t have a size attribute and an onchange event.

  3. adam

    This post was a life-saver. I just used setTimeout and it worked great. I was pulling my hair out and trying to meet a deadline… awesome post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén