fix Standalone mode can't be triggered via keyboard #11
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cap.js/widget",
|
||||
"version": "0.0.20",
|
||||
"version": "0.0.21",
|
||||
"description": "Client-side widget for Cap. Cap is a lightweight, modern open-source CAPTCHA alternative designed using SHA-256 PoW.",
|
||||
"keywords": [
|
||||
"account security",
|
||||
|
||||
+11
-1
@@ -123,7 +123,7 @@
|
||||
const apiEndpoint = this.getAttribute("data-cap-api-endpoint");
|
||||
if (!apiEndpoint) throw new Error("Missing API endpoint");
|
||||
|
||||
const { challenge, target, token } = await (
|
||||
const { challenge, token } = await (
|
||||
await fetch(`${apiEndpoint}challenge`, {
|
||||
method: "POST",
|
||||
})
|
||||
@@ -255,6 +255,16 @@
|
||||
if (!this.#div.hasAttribute("disabled")) this.solve();
|
||||
});
|
||||
|
||||
this.#div.addEventListener("keydown", (e) => {
|
||||
if (
|
||||
(e.key === "Enter" || e.key === " ") &&
|
||||
!this.#div.hasAttribute("disabled")
|
||||
) {
|
||||
e.preventDefault();
|
||||
this.solve();
|
||||
}
|
||||
});
|
||||
|
||||
this.addEventListener("progress", this.boundHandleProgress);
|
||||
this.addEventListener("solve", this.boundHandleSolve);
|
||||
this.addEventListener("error", this.boundHandleError);
|
||||
|
||||
Reference in New Issue
Block a user