IE7 Menu Flickering / Toggling Glitch

Just before we shipped IE7 we heard sporadic reports of a "Heisenbug" where users would click a tab or click in the address bar, and the IE window would start shaking (or "flickering", or "menus bouncing up and down", depending on how users described it). We researched the bug and contacted some end users, but it remained a mystery until an employee on another team reported the issue and we were able to do some local debugging.

To make a long story short, it turned out to be a issues between IE7's multi-threaded design, the auto-hide menus, and an optional "Office Handwriting" component which provides an on-screen keyboard that doesn't get installed with the default settings. When the user clicks a tab (or performs certain other UI operations) the on-screen keyboard would detect that a UI thread is losing focus and uses SendInput() to synthesize the Alt-Up keystroke (along with several others). Alt-Up is the signal in IE to give focus to the menus, auto-expanding them if needed. This new focus change would then be detected by the on-screen keyboard, resulting in it sending another Alt-Up keystroke which, under the right circumstances, causes the cycle to repeat until the user clicks outside the IE window.

My understanding is that this component isn't widely used anymore (it's not the same on-screen keyboard that Tablet PC uses), and of the people I've been in contact with who reported this problem, none of them were actually using the functionality it provides. Fortunately it's easy to disable. From the IE7 Release Notes:

To work around this problem, disable the On-Screen Keyboard component of the Handwriting Recognition Service:

  1. Click Start, and then click Control Panel.
  2. Click Regional and Language Options.
  3. Click the Languages tab.
  4. Click the Details button.
  5. Under Handwriting Recognition select On-Screen Standard Keyboard.
  6. Click Remove.
  7. Under Handwriting Recognition select On-Screen Symbol Keyboard.
  8. Click Remove.
  9. Click OK twice to save and exit changes.
  10. Restart Internet Explorer 7.

(BTW: I'm not really blaming the on-screen keyboard for having this behavior; it's just an unexpected interaction. Coincidenally, years ago I wrote a piece of software similar to Synergy/Multiplicity which does a similar thing to prevent keys from getting "stuck" down if you had a key pressed while moving the mouse between machines. But it didn't break IE7. ;-) )