Export to GitHub

js-hotkeys - issue #9

error when press any key in textarea, textfield


Posted on Oct 29, 2007 by Grumpy Rabbit

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

Comment #1

Posted on Oct 29, 2007 by Grumpy Kangaroo

Mr. Barysiuk, Can you send the html file of yours?

Thanks Tzury

tzury.by@gmail.com

Comment #2

Posted on Oct 29, 2007 by Grumpy Rabbit

Hello,

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

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

Attachments

Comment #3

Posted on Jan 5, 2008 by Helpful Rabbit

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.

Comment #4

Posted on Jan 6, 2008 by Grumpy Kangaroo

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

Status: Invalid

Labels:
Type-Defect Priority-Medium