-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
* fix: Enter doesn't fire trust click event * Commit fixture
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<main> | ||
<h1>Test enter accessibility</h1> | ||
|
||
<button id="click-enter">Test</button> | ||
|
||
<ul id="events"></ul> | ||
</main> | ||
</body> | ||
|
||
<script> | ||
document.getElementById("click-enter").addEventListener("click", (e) => { | ||
let li = document.createElement("li"); | ||
li.appendChild( | ||
document.createTextNode( | ||
JSON.stringify({ | ||
isTrusted: e.isTrusted, | ||
type: e.type, | ||
}) | ||
) | ||
); | ||
|
||
window.events.appendChild(li); | ||
}); | ||
</script> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,20 +69,21 @@ export async function realPress( | |
|
||
for (const key of keyDefinitions) { | ||
modifiers |= keyToModifierBitMap[key.key] ?? 0; | ||
|
||
await fireCdpCommand("Input.dispatchKeyEvent", { | ||
type: key.text ? "keyDown" : "rawKeyDown", | ||
modifiers, | ||
enter: | ||
key.code === "Enter" | ||
? { | ||
type: "char", | ||
unmodifiedText: "\r", | ||
text: "\r", | ||
} | ||
: {}, | ||
...key, | ||
}); | ||
|
||
if (key.code === "Enter") { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Andarist
Collaborator
|
||
await fireCdpCommand("Input.dispatchKeyEvent", { | ||
type: "char", | ||
unmodifiedText: "\r", | ||
text: "\r", | ||
}); | ||
} | ||
|
||
await new Promise((res) => setTimeout(res, options.pressDelay ?? 25)); | ||
} | ||
|
||
|
note (mostly for myself) - in Playwright those work without an additional command for the
"char"
: