mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-17 02:56:16 +08:00
🚧Improve tab usability (#3296) devkennyy
* 🚸Call `screenshot` after `Enter` is pressed `screenshot` is only called on click which does not support tab usage. * 🐛 Make `Contact` and `Donate` fields tabbable * ♿️ Open leaderboard popup on `Enter` keypress * ♿️ Open support popup on `Enter` keypress * ♿️ Open contact popup on `Enter` keypress * ✏️ Rename `Donate` field to `Support` * ♿️ Hide `contact` and `support` popups on `Escape`
This commit is contained in:
parent
8edcfe22f6
commit
27a7358a11
5 changed files with 55 additions and 3 deletions
|
@ -796,3 +796,9 @@ $(document).on("click", "#top #menu .textButton", (e) => {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on("keypress", "#top #menu .textButton", (e) => {
|
||||
if (e.key === "Enter") {
|
||||
$(e.currentTarget).trigger("click");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,3 +18,23 @@ $(document.body).on("click", "#contactPopupWrapper", (e) => {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document.body).on(
|
||||
"keypress",
|
||||
"#contactPopupButton, #contactPopupButton2",
|
||||
(e) => {
|
||||
if (e.key === "Enter") {
|
||||
$(e.currentTarget).trigger("click");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$(document).on("keydown", (e) => {
|
||||
if (e.key === "Escape" && !$("#contactPopupWrapper").hasClass("hidden")) {
|
||||
$("#contactPopupWrapper")
|
||||
.css("opacity", 1)
|
||||
.animate({ opacity: 0 }, 125, () => {
|
||||
$("#contactPopupWrapper").addClass("hidden");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -33,3 +33,23 @@ $(document.body).on("click", "#supportMeWrapper a.button", () => {
|
|||
$("#supportMeWrapper").addClass("hidden");
|
||||
});
|
||||
});
|
||||
|
||||
$(document.body).on(
|
||||
"keypress",
|
||||
"#supportMeButton, #supportMeAboutButton",
|
||||
(e) => {
|
||||
if (e.key === "Enter") {
|
||||
$(e.currentTarget).trigger("click");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$(document).on("keydown", (e) => {
|
||||
if (e.key === "Escape" && !$("#supportMeWrapper").hasClass("hidden")) {
|
||||
$("#supportMeWrapper")
|
||||
.css("opacity", 1)
|
||||
.animate({ opacity: 0 }, 125, () => {
|
||||
$("#supportMeWrapper").addClass("hidden");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -912,6 +912,12 @@ $(document.body).on("click", "#saveScreenshotButton", () => {
|
|||
screenshot();
|
||||
});
|
||||
|
||||
$("#saveScreenshotButton").on("keypress", (e) => {
|
||||
if (e.key === "Enter") {
|
||||
screenshot();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", "#testModesNotice .textButton.blind", () => {
|
||||
UpdateConfig.setBlindMode(!Config.blindMode);
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<div class="leftright">
|
||||
<div class="left">
|
||||
<a class="textButton" id="contactPopupButton">
|
||||
<a tabindex="0" class="textButton" id="contactPopupButton">
|
||||
<i class="fas fa-fw fa-envelope"></i>
|
||||
<div class="text">Contact</div>
|
||||
</a>
|
||||
|
@ -63,9 +63,9 @@
|
|||
<i class="fas fa-fw fa-lock"></i>
|
||||
<div class="text">Privacy</div>
|
||||
</a>
|
||||
<a id="supportMeButton" class="textButton">
|
||||
<a tabindex="0" id="supportMeButton" class="textButton">
|
||||
<i class="fas fa-fw fa-donate"></i>
|
||||
<div class="text">Donate</div>
|
||||
<div class="text">Support</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
|
|
Loading…
Add table
Reference in a new issue