Closed
Bug 433415
Opened 16 years ago
Closed 2 years ago
Keyboard events are inconsistent across platforms
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
DUPLICATE
of bug 599887
People
(Reporter: erik, Unassigned)
Details
Attachments
(1 file)
Given a textarea that has keydown, keypress and keyup events, different events are fired on Mac and Windows when the user holds down a key. On Windows keydown and keypress repeat. On mac only keypress repeats. What is worse is that calling event.preventDefault in keydown prevents the text input on Windows but not on Mac. This is very inconsistent with other browser and it is even inconsistent between the same Firefox version across different platforms. I suggest the following: 1. Both keydown and keypress repeats for all platforms. 2. Only keys that generate text fires keypress (escape is an exception due to compatibility reasons) 3. Calling preventDefault on keydown prevents text from being outputted and prevents keypress from being fired. Following these 3 rules will make keyboard handling a lot simpler for a lot of applications.
Reporter | ||
Comment 1•16 years ago
|
||
Clarification: A or ESC. Not a and escape at the same time.
Comment 2•16 years ago
|
||
(In reply to comment #0) > 1. Both keydown and keypress repeats for all platforms. Is the current behavior on Mac a regression? Is the behavior the same on FF2 and FF3? > 2. Only keys that generate text fires keypress (escape is an exception due to > compatibility reasons) This is something that might eventually be defined in DOM 3 Events. I think the better would be to always fire keypress, except with alt,shift,ctrl,capslock,numlock,... Windows-gecko gets this right, I think. > 3. Calling preventDefault on keydown prevents text from being outputted and > prevents keypress from being fired. This would change also the Windows behavior and this depends on what we think is the default handling behavior for keydown event. This suggests that it is to dispatch keypress, but on Windows-gecko it has for a long time been to prevent keypress's default handling. I agree that Gecko should behave the same way on all platforms. Key handling in different browsers varies a lot. Gecko has its old traditions and changing those is *very* regression-risky. Webkit tries to emulate IE, usually successfully, but for example with IME some strange events are dispatched. Opera does something else.
Component: DOM: Events → Event Handling
Assignee | ||
Updated•5 years ago
|
Component: Event Handling → User events and focus handling
Comment 3•2 years ago
|
||
In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.
Severity: major → --
Comment 4•2 years ago
|
||
Olli, do you think we can close this now? When I tried the test case on OSX, and held down a key, I got repeated keydown until I released the key, then I got a single keyup. This was for both a and escape, and was the same across Firefox, Safari, and Chrome.
Severity: -- → S3
Flags: needinfo?(smaug)
Comment 5•2 years ago
|
||
I didn't see keypress events at all.
Comment 6•2 years ago
|
||
Oh, this was fixed in bug 599887.
Status: NEW → RESOLVED
Closed: 2 years ago
Duplicate of bug: 599887
Flags: needinfo?(smaug)
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•