impr: automatically refocus the test when closing the command line on the test page

This commit is contained in:
Miodec 2024-03-20 20:56:50 +01:00
parent 57d9fc3b04
commit e551e043af

View file

@ -7,6 +7,8 @@ import { clearFontPreview } from "../ui";
import AnimatedModal, { ShowOptions } from "../utils/animated-modal";
import * as Notifications from "../elements/notifications";
import * as OutOfFocus from "../test/out-of-focus";
import * as ActivePage from "../states/active-page";
import { focusWords } from "../test/test-ui";
type CommandlineMode = "search" | "input";
type InputModeParams = {
@ -114,10 +116,16 @@ export function show(
function hide(clearModalChain = false): void {
clearFontPreview();
void ThemeController.clearPreview();
if (ActivePage.get() === "test") {
focusWords();
}
void modal.hide({
clearModalChain,
afterAnimation: async () => {
addCommandlineBackground();
if (ActivePage.get() === "test") {
focusWords();
}
},
});
}