Skip to content

Commit 34dcc3a

Browse files
committed
Escでstage-selectからメインメニューに戻れるようにした
1 parent e7934e3 commit 34dcc3a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

routes/stage-select/+page.svelte

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ function handleKey(e: KeyboardEvent): void {
7979
}
8080
} else if (e.key === "Enter" || e.key === " ") {
8181
window.location.href = blocks[selected].link;
82+
} else if (e.key === "Escape") {
83+
window.location.href = "/";
84+
e.preventDefault();
8285
}
8386
}
8487
function handleKeyUp() {
@@ -102,13 +105,17 @@ onMount(() => {
102105
<div class="w-full h-full py-8 backdrop-blur-xs flex flex-col">
103106
<div class="">
104107
<button class="btn modal-btn text-xl ml-8 mb-6 w-max! px-4!">
105-
<a href="/">&lt; Back to Main Menu</a>
108+
<a href="/">
109+
&lt;
110+
<Key key="Esc" enabled />
111+
Back to Main Menu
112+
</a>
106113
</button>
107114
</div>
108115
<div class="text-7xl text-center flex items-center justify-center gap-8">
109116
<!-- 左矢印ボタン -->
110117
<button
111-
class="px-4 select-none cursor-pointer {Number(world) <= 1
118+
class="appearance-none focus:outline-none px-4 select-none cursor-pointer {Number(world) <= 1
112119
? 'invisible'
113120
: ''} hover:-translate-y-1 hover:text-gray-700 active:translate-y-0 active:text-black"
114121
aria-label="前のワールド"
@@ -120,7 +127,7 @@ onMount(() => {
120127
<span>World {world}</span>
121128
<!-- 右矢印ボタン -->
122129
<button
123-
class="px-4 select-none cursor-pointer {Number(world) >= 4
130+
class="appearance-none focus:outline-none px-4 select-none cursor-pointer {Number(world) >= 4
124131
? 'invisible'
125132
: ''} hover:-translate-y-1 hover:text-gray-700 active:translate-y-0 active:text-black"
126133
aria-label="次のワールド"

0 commit comments

Comments
 (0)