User Agent: Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release) Build ID: 20131205075310 Steps to reproduce: Create a <select> box with the multiple attribute and an onkeypress function. Pressing enter while focused on the <select> does not trigger an event. JSFiddle example: http://jsfiddle.net/sLDX7/ If the multiple attribute is removed (and everything else kept the same), then pressing enter while focused on the <select> does trigger an event with keycode 13. Actual results: The <select> without multiple received keypress events from the enter key. The <select> with multiple did not receive keypress events from the enter key. Expected results: Consistency, one way or the other. I'd prefer that the enter key triggers a keypress event in both cases, but having divergent behavior based on the multiple attribute is confusing. Older versions circa FF 17 or so did have an event in both cases.
This is by design. For DOM Level 3 Events, we stop dispatching keypress event if preceding keydown event is consumed by a call of preventDefault() starting with 25. At that time, we make <select> elements consume keydown event if non-printable key is pressed and it may be handled by the <select> element. Therefore, now, <select> element may consume Enter keydown event and it causes stopping dispatching following keypress event. Please use keydown event for handling non-printable keys like Enter key on *any* elements.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.