agungprasetyosakti / js-hotkeys

Automatically exported from code.google.com/p/js-hotkeys
0 stars 0 forks source link

Unbinding events doesn't completely unbind them #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Bind a shortcut to an element
2. Unbind the shortcut
3. Bind the same shortcut to the same element again

What is the expected output? What do you see instead?
--The shortcut is disabled when unbound, but when it is rebound it is now 
bound twice!

What version of the product are you using? On what operating system?
--v0.7.8

Please provide any additional information below.
--This is especially relevant for AJAX apps, as you must rebind the event, 
but it is then bound twice! (Pressing the shortcut fires the event twice.)

Original issue reported on code.google.com by joshua.b...@gmail.com on 23 Jun 2009 at 9:06

GoogleCodeExporter commented 8 years ago
use lower case notation for 'shift+', 'alt+' and 'ctrl+'

Original comment by chpalati...@gmail.com on 4 Dec 2009 at 8:51

GoogleCodeExporter commented 8 years ago
I have the same issue with unbind.

I have been trying to bind when an input textbox takes focus and unbind on blur 
of 
the textbox. 

It binds correctly on focus but wont unbind on blur. This means that each time 
you 
click in a textbox (give it focus) its binding multiple times. 

I thought this may be due to the cursor being inside a textbox and so the 
hotkeys are 
disabled. But im not convinced this is the problem as surely it should still 
unbind.

Ive been using this code to try it out...

var row;
//identify input with focus
$('input[name=autoSaveOrderItem]').live('focus', function() {
    //identify row id with focus
    var row = $(this).parent().parent().attr('id');
    console.log('focused');
    //F6 duplicate item line
    $(this).bind('keydown', 'f6', function (){
        console.log('bound');       
        //return false; 
    });//bind
}).live('blur', function() {
    //var row = null;
    console.log('blurred');
        $(this).unbind('keydown', 'f6', function (){
            console.log('unbound');
            return false;
       });//unbind
});

Is it possible to exclude keys from ever being disabled inside a textbox ie the 
function keys and other keys that have no effect on text inputs?

Original comment by benho...@gmail.com on 26 Feb 2010 at 4:29