NEW 239964
The select element does not fire click events
https://bugs.webkit.org/show_bug.cgi?id=239964
Summary The select element does not fire click events
Daniel Jacobs
Reported 2022-05-02 08:19:12 PDT
Created attachment 458681 [details] Safari behavior tested Create this page and see that the click event is not triggered when using normal nor accessible ways of choosing options: <!DOCTYPE html> <html> <body> <h1>Onclick select test</h1> <label for="select">Select an option:</label> <select id="select"> <option value="1">One</option> <option value="2">Two</option> </select> <div>Total number of onclick events: <span id="output">0</span></div> <script> const select = document.getElementById("select"); const output = document.getElementById("output"); select.addEventListener("click", function() { output.textContent = parseInt(output.textContent) + 1; }); </script> </body> </html> What Chromium browsers do is trigger the click event for select elements whenever an option is selected. This includes triggering the event when selection is made using the keyboard. When to fire it is arguable: you could argue it should fire both when opening the select and selecting an option, though I feel that's less useful and that doesn't match Chromium behavior. However, it should not never fire, and it currently doesn't in Safari. cc: https://bugzilla.mozilla.org/show_bug.cgi?id=1767062
Attachments
Safari behavior tested (124.76 MB, video/quicktime)
2022-05-02 08:19 PDT, Daniel Jacobs
no flags
Test case (524 bytes, text/html)
2022-05-02 08:26 PDT, Daniel Jacobs
no flags
Daniel Jacobs
Comment 1 2022-05-02 08:26:36 PDT
Created attachment 458682 [details] Test case
Radar WebKit Bug Importer
Comment 2 2022-05-09 08:20:32 PDT
Daniel Jacobs
Comment 3 2022-05-09 08:44:38 PDT
Note You need to log in before you can comment on or make changes to this bug.