Answered by:
Select box size change crashes IE11

Question
-
I'm the lead developer for CarComplaints.com, woke up this morning to a ton of emails from IE11 users complaining that clicking on our select boxes crashes the browser.
The affected dropdowns start with the select box size set to show multiple options, & then we set the select box's size attribute back to 1 with an onchange event. Pretty basic.
I narrowed the problem down to this: http://jsfiddle.net/8GT7u/
For a workaround, I found if I change the code so the size is set within a setTimeout(), then IE11 handles it without crashing. Any suggestions or other workarounds?
- Edited by CarComplaints dot com Tuesday, December 31, 2013 8:43 PM minor
Tuesday, December 31, 2013 8:37 PM
Answers
-
For a workaround, I found if I change the code so the size is set within a setTimeout(), then IE11 handles it without crashing. Any suggestions or other workarounds?
The best, or the easiest workaround on this issue, (reusing code given by Mr. Max) is to:
<!DOCTYPE html> <html> <head> <title>select size 1</title> <meta charset="utf-8"> </head> <body> <select size=2 onclick="this.size=1"> <option selected>click on me</option> <option>or me!</option> </select> </body> </html>
and preserve the "onchange" event for something else.
p.s.: your fiddle updated with this workaround is here: http://jsfiddle.net/8GT7u/3/
- Marked as answer by CarComplaints dot com Wednesday, January 1, 2014 12:08 PM
Wednesday, January 1, 2014 3:46 AM
All replies
-
For a workaround, I found if I change the code so the size is set within a setTimeout(), then IE11 handles it without crashing. Any suggestions or other workarounds?
The best, or the easiest workaround on this issue, (reusing code given by Mr. Max) is to:
<!DOCTYPE html> <html> <head> <title>select size 1</title> <meta charset="utf-8"> </head> <body> <select size=2 onclick="this.size=1"> <option selected>click on me</option> <option>or me!</option> </select> </body> </html>
and preserve the "onchange" event for something else.
p.s.: your fiddle updated with this workaround is here: http://jsfiddle.net/8GT7u/3/
- Marked as answer by CarComplaints dot com Wednesday, January 1, 2014 12:08 PM
Wednesday, January 1, 2014 3:46 AM -
That's perfect, very clean solution. Thanks, I appreciate it!
- Edited by CarComplaints dot com Wednesday, January 1, 2014 1:04 PM whoops didn't realize you meant the other reply by "Mr. Max"
Wednesday, January 1, 2014 12:10 PM -
Why thank you :) We always start out with an select box open to show multiple options with none selected, so any click is fine .... I think anyway, couldn't find any situations where onclick vs onchange made a difference with our use case.Wednesday, January 1, 2014 4:34 PM
-
For what it's worth, anyone (everyone) also experiencing this IE11 crash, please go to the "Internet Explorer Feedback" site & use the search feedback box to find these 2 bug reports:
812635, 811718
.. for each, find the "X users can reproduce this bug" section in the middle & click on "I can too".
(Sorry, MSDN won't let me post links yet)
Thanks!Wednesday, January 1, 2014 6:40 PM -
Re the "change keyup" combo, there was some browser/version awhile back that didn't fire a "change" event when the keyboard arrows were used to pick the select object option. You had to use the combo of change + keyup events to handle it properly.
Normally I could look back in Git (our code revision tracking system) for the commit notes on that, but we switched to Git in 2010 & our use of that event combo code pre-dates that... it's probably not required anymore, but who knows. Anyone else remember which browser/version made that code necessary?
Wednesday, January 1, 2014 7:42 PM