agungprasetyosakti / js-hotkeys

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

error when press any key in textarea, textfield #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. add text area or text field in demo
2. try to type in text area/field
3. an error for each pressing

What is the expected output? What do you see instead?
See this error:
inspector(Object type=keydown target=textarea
currentTarget=html)jquery.hotkeys.js (line 83)
handle(Object type=keydown target=textarea
currentTarget=html)jquery-1.1.4.js (line 1562)
handle()jquery-1.1.4.js (line 1441)
[Break on this error] var cbMap = that.all[element].events[type].callbackMap;

What version of the product are you using? On what operating system?
Use the latest version of hotkeys which I can download from "Downloads" page.

Please provide any additional information below.
Firefox/2.0.0.8 Win 

Original issue reported on code.google.com by S.Barys...@gmail.com on 29 Oct 2007 at 3:53

GoogleCodeExporter commented 8 years ago
Mr. Barysiuk,
Can you send the html file of yours?

Thanks
Tzury

tzury.by@gmail.com

Original comment by Afro.Sys...@gmail.com on 29 Oct 2007 at 5:29

GoogleCodeExporter commented 8 years ago
Hello,

I downloaded jquery.hotkeys.003.zip, unpacked and added this line in the end of 
the body.

<textarea></textarea><input type="text" style="width:200px"/>

Then run your example in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.8.1.8)
Gecko/20071008 Firefox/2.0.0.8 and got an error when I was typing in text area 
or
text input field. It seems that propagate: false doesn't work correctly. In IE 7
everything is ok.

Thanks,
Siarhei 

Original comment by S.Barys...@gmail.com on 29 Oct 2007 at 5:53

Attachments:

GoogleCodeExporter commented 8 years ago
I encountered the same problem with Mozilla/5.0 (Macintosh; U; Intel Mac OS X; 
de;
rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 

I proked and prodded the code a bit, inspected it with Firebug, and came up 
with the
following lines of code (insert after line 77):

if (jQuery.browser.mozilla) {
    var target = jQuery(element);
    if (target.is("input") || target.is("textarea")) {
        while (!that.all[element] && element.parentNode) {
        element = element.parentNode;
    }
    }
}

I haven't tested all cases (only pageup events attached to the html element) 
but at
least the error doesn't show up anymore. 

Original comment by gabriel....@gmail.com on 5 Jan 2008 at 11:47

GoogleCodeExporter commented 8 years ago
When the cursor is located inside an input field and a user hit "x" or 
"Shift+x", it
is most likely that he/she wants to enter the 'x' or 'X' character into that 
field. 
By default, input fields captured most of keyboard events and the browser dose 
not
pass it into the js-dom scope.
There is your solution which propagate it up to the _n_ - parentNode - (That is
overriding the whole default behavior).
or specify {target:'INPUT_ID') and have your code overriding only desire 
behavior 

Original comment by Afro.Sys...@gmail.com on 6 Jan 2008 at 9:58