mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-26 16:57:07 +08:00
refactor: redo the way focus is handled for popup
This commit is contained in:
parent
ff31b17687
commit
413c6d72d6
2 changed files with 3 additions and 11 deletions
|
|
@ -140,7 +140,7 @@ export function resetBefore(): void {
|
|||
before.customText = null;
|
||||
}
|
||||
|
||||
export function showPopup(focus = false): void {
|
||||
export function showPopup(): void {
|
||||
if (Config.mode === "zen") {
|
||||
Notifications.add("Practice words is unsupported in zen mode", 0);
|
||||
return;
|
||||
|
|
@ -152,10 +152,7 @@ export function showPopup(focus = false): void {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
if (focus) {
|
||||
console.log("focusing");
|
||||
$("#practiseWordsPopup .missed").trigger("focus");
|
||||
}
|
||||
$(`#${wrapperId}`).trigger("focus");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -190,11 +187,6 @@ $("#practiseWordsPopupWrapper .button").on("keypress", (e) => {
|
|||
}
|
||||
});
|
||||
|
||||
$("#practiseWordsPopupWrapper .button.both").on("focusout", (e) => {
|
||||
e.preventDefault();
|
||||
$("#practiseWordsPopup .missed").trigger("focus");
|
||||
});
|
||||
|
||||
$(document).on("keydown", (event) => {
|
||||
if (event.key === "Escape" && isPopupVisible(wrapperId)) {
|
||||
hidePopup();
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="practiseWordsPopupWrapper" class="popupWrapper hidden">
|
||||
<div id="practiseWordsPopupWrapper" class="popupWrapper hidden" tabindex="-1">
|
||||
<div id="practiseWordsPopup" action="">
|
||||
<div class="title">Practice words</div>
|
||||
<div class="text">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue