Jörn Zaefferer schrieb:
>> I just came across something in IE, that I hadn't noticed so far: It 
>> seems that the escape key triggers some action by default:
>>
>> Say you have a link which on click opens a form via slide down. If you 
>> then press the escape key, the form slides up again... Is it just me or 
>> did someone else notice that as well? Just wondering if it's Plazes 
>> specific due to my style of coding.
>>
>> For example have a look at the http://plazes.com homepage (sorry, this 
>> is no advertise): There's a login link in the upper right corner, that 
>> triggers a login form to be revealed. If the form is visible in IE press 
>> escape and you will see, that it gets hidden again...
>>
>> I really don't know what's happening?
> 
> Do you use Thickbox for that form? If so, take a look at it's 
> document.onkeyup binding. If not: Ugh, no idea.
> 
> I took a look, but couldn't find it for myself...

If you want to disable that behavior (I had to because pressing escape 
in a thickbox screen triggered the hide on reset...):

if ($.browser.msie) {
     $(document).keydown(function() {
         window.stopEsc = true;
     }).keyup(function() {
         window.stopEsc = false;
     });
}

and then:

$('form').reset(function() {
     if (window.stopEsc)  return false; // in IE the escape key triggers 
the reset action of a form, don't wan't that here
}

Fortunately the reset event is fired between keydown and keyup, tested 
in IE 6/7...


-- Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to