Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

keydown handler receives keydown event when Ctrl is pressed in URL field of IE

$
0
0

Hello

In IE11 (i.e. in 11.0.9600.17501) and IE10 (i.e. in 10.0.9200.16384) there is a strange behavior of firing a keydown event.

There is a form with two input fields:

<form><inputclass="usernameField"type="text"></input><br><inputclass="passwordField"type="password"></input><br></form>

and there are the following handlers (jQuery 1.11.0):

$(document).ready(function(){
    $('.usernameField').keydown(function(event){
        console.log('usernameField keydown');});
    $('.usernameField').keyup(function(event){
        console.log('usernameField keyup');});
    $('.passwordField').keydown(function(event){
        console.log('passwordField keydown');});
    $('.passwordField').keyup(function(event){
        console.log('passwordField keyup');});});

1) Let's reproduce the issue with the username field

  • Put focus at username field.
  • Then click at browser's URL field.
  • Press Ctrl on keyboard.
  • The keydown handler of the username field receives an event. I.e. see 'usernameField keydown' in console.

2) Now let's do the same with password field

  • Put focus at password field.
  • Then click at browser's URL field.
  • Press Ctrl on keyboard.
  • The keydown handler of the password field receives an event. I.e. see 'passwordField keydown' in console.

The same issue can be reproduced without jQuery:

<script>function keyIsDownOnUsername(event){
        console.log('keyIsDown on username');}function keyIsUpOnUsername(event){
        console.log('keyIsUp on username');}function keyIsDownOnPassword(event){
        console.log('keyIsDown on password');}function keyIsUpOnPassword(event){
        console.log('keyIsUp on password');}</script><form><inputonkeydown="keyIsDownOnUsername(event)"onkeyup="keyIsUpOnUsername(event)"type="text"></input><br><inputonkeydown="keyIsDownOnPassword(event)"onkeyup="keyIsUpOnPassword(event)"type="password"></input><br></form>

IMHO it's a bug and it should be fixed.

P.S. JFYI: keyup event (for Ctrl key) is not fired in all of these cases.


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>