Bug 226148

Summary: window.onkeydown event.target returns html element when focused on checkbox input element
Product: WebKit Reporter: John A. Bilicki III <jab_creations>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: akeerthi, ap, cdumez
Priority: P2    
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case to easily demonstrate the bug and a small work-around. none

John A. Bilicki III
Reported 2021-05-22 17:21:39 PDT
Created attachment 429442 [details] Test case to easily demonstrate the bug and a small work-around. While this bug is simple how I came across it isn't so I will try to explain it as best as I can and produce a publicly accessible page so others can easily reproduce this bug. The window.onkeydown's event.target is returning the html element instead of the input checkbox element that was clicked. I sometimes get excessive test emails (e.g. working on a cron job) and sometimes my inbox is half-full with these emails so I can't use the check-all checkbox or obviously I'd select other emails that I do not want to delete. I spent some time earlier creating a script that when pressing the up or down arrow key will make the corresponding checkbox above or below match the window.onkeydown/event.target's checked state so I can select the emails I want to delete much faster than manually clicking on ~50 checkbox input elements. I've attached a test case that also includes a non-intuitive work-around. The input checkbox elements are NOT inside of label elements to reduce potential confusion. Blink/Chrome and Gecko/Waterfox/Firefox correctly reference the input element instead of the html element in this circumstance.
Attachments
Test case to easily demonstrate the bug and a small work-around. (2.37 KB, application/xhtml+xml)
2021-05-22 17:21 PDT, John A. Bilicki III
no flags
Alexey Proskuryakov
Comment 1 2021-05-24 15:02:45 PDT
This is correct behavior - clicking on the checkbox doesn't focus it on macOS. *** This bug has been marked as a duplicate of bug 22261 ***
Note You need to log in before you can comment on or make changes to this bug.