Opened 9 years ago
Closed 9 years ago
#14669 closed bug (duplicate)
event.which failing for Shift + 7 (&) as Code 38 (Up Arrow)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have a simple batch of code that prevents up/down/tab/enter on a field:
if ($.inArray(event.which, [9, 38, 40, 13]) > -1) { event.preventDefault(); return false; }
However, if I type something like "example&" the code fires went I hit "&". If I put a break in there I can see that the event.which says its 38, and the other attributes of the event agree.
If I do other special characters such as or *, nothing happens, and if I hit the up arrow, the code fires as expected saying that it too is "38"
Change History (5)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Example inJSFiddle:
You can verify the problem there; I had a moment of panic where I thought the problem might be more complex than this.
comment:3 Changed 9 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:4 Changed 9 years ago by
Status: | pending → new |
---|
You are right that it is the keypress event that is throwing the odd code. Weird... I'll review Monday and update if just removing keypress from this listener resolves this issue; I'm certain there was a reason why keypress was originally added since its common to avoid it.
Thanks!
comment:5 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #7183.
Seems that way to me, I can reopen if not.
I've tested this in Chrome 31 and a recent FF with the same result. Running on a Windows 7 box... not sure what else would be relevant.