Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE is randomly minimizing when a link is clicked

I have the bizarre problem. When I click on a link in IE7 the window minimizes. It seems to only be a subset of the links on the page. It also doesn't consistently happen with the same link and differs from computer to computer.

example link text:
<a hidefocus="on" href="#" tabindex="1"><span unselectable="on" id="extdd-102">Canadian Legislation</span></a>

Anyone seen this before or have any idea what might be causing it?

like image 594
alumb Avatar asked Aug 27 '10 16:08

alumb


2 Answers

Finally figured it out. It was actually a custom JavaScript click handler that caused the problem.

My click handler was calling activeElement.blur(); on the current active element (so that events tied to blur fired when the elements were destroyed).

Problem is in IE, if you call blur on anything that isn't an INPUT, it minimizes the window.

like image 88
alumb Avatar answered Nov 18 '22 19:11

alumb


I had the same issue on Internet Explorer 10.

  • Internet Explorer 10 tested behaviour:

This issue only happen when you invoke the blur() function on document.body element.

Issue can be reproduced simply executing

 document.body.blur() 
in your browser console.
  • Common scenario in which this issue happens:

document.activeElement.blur() function invocation is the most common scenario in which this issue occurs because after first invocation of document.activeElement.blur() the body element will become the activeElement and subsequent call to document.activeElement.blur() will invoke blur on body element.

  • Solution:

avoid document.body.blur() function invocation, if you have jquery you can introduce this simple logic

 $(yourObj).is('body') 

to check if your object is the body element, in order to avoid blur() function invocation on it

like image 43
Marcello Montemagno Avatar answered Nov 18 '22 19:11

Marcello Montemagno