Closed
Bug 28323
Opened 25 years ago
Closed 24 years ago
[DOM] onkeydown="return false" doesn't cancel the key in INPUT TYPE="text"
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P2)
Tracking
()
Future
People
(Reporter: martin.honnen, Assigned: joki)
References
Details
(Keywords: testcase)
Attachments
(1 file)
(deleted),
text/html
|
Details |
NN4 and IE4/5 allow to cancel a key press with
<INPUT TYPE="text" ONKEYDOWN="return false">
M13 just calls the handler but doesn't cancel the key press but displays all
keys.
<SCRIPT>
function validateNonNumber (evt) {
var keyCode = evt.which ? evt.which : evt.keyCode;
return keyCode < '0'.charCodeAt() || keyCode > '9'.charCodeAt();
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="aForm">
<INPUT TYPE="text" NAME="field"
ONKEYDOWN="return false"
>
<BR>
<INPUT TYPE="text" NAME="aField"
ONKEYDOWN="return validateNonNumber(event)"
>
</FORM>
This is standard version 4 browser event handling stuff so it should work with
NN5 even if DOM standards exclude key event handling
Reporter | ||
Comment 1•25 years ago
|
||
Comment 2•25 years ago
|
||
Marking testcase and 4xp and m17.
Assignee | ||
Comment 3•24 years ago
|
||
Adding [DOM] prefix to bugs related to DOM Level 0, 1, or 2
compatibility/compliance.
Status: NEW → ASSIGNED
Summary: onkeydown="return false" doesn't cancel the key in INPUT TYPE="text" → [DOM] onkeydown="return false" doesn't cancel the key in INPUT TYPE="text"
Comment 5•24 years ago
|
||
Mass update: changing qacontact to ckritzer@netscape.com
QA Contact: janc → ckritzer
Comment 6•24 years ago
|
||
->saari for dup
Comment 8•24 years ago
|
||
PDT: Nominating nsbeta3+
Reason: HTML4 compliance, DOM compliance;
Comment 9•24 years ago
|
||
nominating, per ckritzer comment.
Comment 10•24 years ago
|
||
*** Bug 50469 has been marked as a duplicate of this bug. ***
While investigating bug 50478 it looks like the GetCancelable is implemented
wrong, and probably we never set the cancelable property.
Comment 12•24 years ago
|
||
This event should also be cancelable by the DOM2 method preventDefault() on the
event object.
Assignee | ||
Comment 15•24 years ago
|
||
So we've had some discussion about this. We have in the past allowed onkeydown
to stop character input but we've encourage the use of onkeypress instead.
Current specs in process seem to lean somewhat more towards this as well. They
may of course change.
For the moment in our current architecture it is easy to make
'onkeypress="return false" work. I have done this. This will fix a number of
similar cases and provide a workaround for anyone running into this. It is much
harder to do the same for onkeydown and it will not get done for this release.
I'm going to remove the nsbeta3 and set this bug to future. I believe that with
the workaround it is now a lower priority bug. The break in compatibility is
unfortunate but at the moment it seems to be necessary.
Comment 16•24 years ago
|
||
joki: Great, if I can do that with "onkeypress". The main use for canceling
here is masked input.(textfields/textareas). If the "onkeypress" implementation
will allow that, that's enough (for me, at least).
Comment 18•24 years ago
|
||
Um-call me silly, but is this bug very related to
http://bugzilla.mozilla.org/show_bug.cgi?id=1572
If not entirely a duplicate? Anyone? You there, in the back? Slap me if I just
don't get it.
Comment 19•24 years ago
|
||
Yes, it seems to be a duplicte. This one has a testcase attached however.
Comment 20•24 years ago
|
||
*** This bug has been marked as a duplicate of 1572 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•