- From: Daniel Bates <notifications@github.com>
- Date: Tue, 05 Mar 2019 15:00:48 -0800
- To: w3c/uievents <uievents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/uievents/issues/225@github.com>
1. Open the following example page in a browser:
```
<!DOCTYPE html>
<html>
<body>
<input type="checkbox">
<pre id="console"></pre>
<script>
let checkbox = document.querySelector("input");
function logKeyEvent(event)
{
logMessage(`${event.type} key: ${event.key} keyCode: ${event.keyCode}`);
}
function logEvent(event)
{
logMessage(`${event.type}`);
}
function logMessage(message)
{
document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}
function handleFocus()
{
checkbox.addEventListener("keydown", logKeyEvent);
checkbox.addEventListener("keypress", logKeyEvent);
checkbox.addEventListener("keyup", logKeyEvent);
checkbox.addEventListener("change", logEvent);
checkbox.addEventListener("click", logEvent);
}
checkbox.addEventListener("focus", handleFocus, { once: true });
</script>
</body>
</html>
```
2. Focus the checkbox. On Mac Safari and Chrome Version 74.0.3725.0 (Official Build) canary (64-bit) you can do this by pressing Option + Tab. On Mac Firefox 65.0.1 , just press Tab.
3. Press the spacebar to activate.
What events should be dispatched?
Safari and Chrome have identical output, ignoring the initial keyups for the Option + Tab keys (used to focus the checkbox), emphasis mine:
```
keydown key: keyCode: 32
***keypress key: keyCode: 32***
keyup key: keyCode: 32
click
change
```
But Firefox outputs, ignoring the initial keyup for the Tab key (used to focus the checkbox), emphasis mine:
```
keydown key: keyCode: 32
***keypress key: keyCode: 0***
keyup key: keyCode: 32
click
***DOMActivate***
change
```
All browsers fire a keypress event. Though Firefox also dispatches a DOMActivate event. The spec. does not seem to say what is the correct events and event ordering. The wording in <https://w3c.github.io/uievents/#legacy-uievent-event-order> says that if you fire a DOMActivate (like Firefox) then it seems that you don't fire a keypress. Firefox is not abiding by this. But the spec does not seem to mention how to handle activation if a DOMActivate event is ***not*** dispatched like in Chrome and Safari. Can we please spec this behavior out clearly?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/225
Received on Tuesday, 5 March 2019 23:01:10 UTC