File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ const game = makeAutoObservable({
9595 clearInterval ( this . timer . handle ) ;
9696 this . timer = undefined ;
9797 this . finished = true ;
98+ setTimeout (
99+ ( ) => document . getElementById ( "kana-typer-reset-button" ) ?. focus ( ) ,
100+ 1 ,
101+ ) ;
98102 }
99103 } ,
100104
@@ -186,6 +190,7 @@ export function KanaTyper() {
186190 < br />
187191 < input
188192 autoFocus
193+ id = "kana-typer-input"
189194 disabled = { game . finished }
190195 value = { game . currentInput }
191196 onKeyDown = { ( evt ) => {
@@ -196,7 +201,15 @@ export function KanaTyper() {
196201 { game . finished && (
197202 < >
198203 < br />
199- < button onClick = { ( ) => game . reset ( ) } > Reset</ button >
204+ < button
205+ id = "kana-typer-reset-button"
206+ onClick = { ( ) => {
207+ game . reset ( ) ;
208+ document . getElementById ( "kana-typer-input" ) ?. focus ( ) ;
209+ } }
210+ >
211+ Reset
212+ </ button >
200213 < br />
201214 < div >
202215 Correct:{ " " }
Original file line number Diff line number Diff line change @@ -105,11 +105,11 @@ function initDiacriticMaps() {
105105 }
106106
107107 const handakutenChars = [
108- [ "ぱ " , "は" ] ,
109- [ "ぴ " , "ひ" ] ,
110- [ "ぷ " , "ふ" ] ,
111- [ "ぺ " , "へ" ] ,
112- [ "ぽ " , "ほ" ] ,
108+ [ "ぱ" , "は" ] ,
109+ [ "ぴ" , "ひ" ] ,
110+ [ "ぷ" , "ふ" ] ,
111+ [ "ぺ" , "へ" ] ,
112+ [ "ぽ" , "ほ" ] ,
113113 ] ;
114114 for ( const [ hiraganaDakuten , hiraganaNormal ] of handakutenChars ) {
115115 const katakanaDakuten = KanaUtils . toKatakana ( hiraganaDakuten ) ;
You can’t perform that action at this time.
0 commit comments