[Webkit-unassigned] [Bug 239964] New: The select element does not fire click events

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 2 08:19:12 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=239964

            Bug ID: 239964
           Summary: The select element does not fire click events
           Product: WebKit
           Version: Safari 15
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: danielhunterjacobs at gmail.com

Created attachment 458681

  --> https://bugs.webkit.org/attachment.cgi?id=458681&action=review

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220502/770c2f9c/attachment-0001.htm>


More information about the webkit-unassigned mailing list