Closed Bug 1552419 Opened 6 years ago Closed 6 years ago

preventDefault does not work on keydown when "space bar" is pressed

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

66 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1487102

People

(Reporter: milko.venkov, Unassigned)

References

Details

(4 keywords)

Attachments

(1 file)

Attached file buttonClick.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.84

Steps to reproduce:

I have a button and I handled keydown event. In the handler I am calling preventDefault. When the button has focus and I press space bar it also fires click event which is not correct. If the button has focus and I press Enter key click event does not fire.
Click event does not fire in MS IE, MS Edge, Google Chrome and Opera.

Actual results:

Click event fired on space bar press event preventDefault is called

Expected results:

Click event should not fire.

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
20190516215643

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → User events and focus handling
Ever confirmed: true
Product: Firefox → Core
See Also: → 1019630, 1229704
Priority: -- → P3
Summary: preventDefault does not work on keydown → preventDefault does not work on keydown when "space bar" is pressed
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE

The bug doesn't seem to be resolved, though marked as duplicate, it exists in Firefox 72. On trying to handle keydown event, it still executes keydown and then click event.

Flags: needinfo?(htsai)

(In reply to ammumaddineni97 from comment #3)

The bug doesn't seem to be resolved, though marked as duplicate

You can clearly see it's a duplicate of a report that's still open.

Flags: needinfo?(htsai)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: