octokatherine / word-master

A Mastermind-like word guessing game
MIT License
381 stars 240 forks source link

enter key restarts game #51

Closed teleshoes closed 2 years ago

teleshoes commented 2 years ago

just a suggestion. ive been hitting F5, but after persistence, that wont work.

maybe instead of this, just focus the button when the modal opens?

also, will rebase this one too. didnt feel like fixing the conflicts twice

teleshoes commented 2 years ago

ah, Keyboard is removed now so this doesnt work. hmm

octokatherine commented 2 years ago

hm, not sure I'm understanding the approach you're taking. I think we should be able to just programmatically give focus to the play again button when the modal pops up using a ref

teleshoes commented 2 years ago

for sure. the event-handling way made a bit more sense when <Keyboard> was always attached. (separating event/HID logic from game logic)

but yeaaa, if i had known that i wouldnt need to muck about with useRef and adding two different useEffect()s in different files for the two different buttons, i definitely wouldnt have bothered. :)

teleshoes commented 2 years ago

@octokatherine this solution appears to Just Work. what do you think?