]> git.cworth.org Git - lmno.games/commitdiff
anagrams: Allow pressing Enter to start a claim
authorCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 15:42:23 +0000 (11:42 -0400)
committerCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 15:42:23 +0000 (11:42 -0400)
If claiming letters from the center, the user can just start typing.

But for a steal, they need another keybinding to initiate the claim
phase and Enter seems like a reasonable option for this.

anagrams/anagrams.jsx

index 3ad6970d10a1e0f40335c0efc9688dad66bf278d..09e5f0453426702b01ac7eb67f589a2ecd46a6bc 100644 (file)
@@ -601,11 +601,15 @@ class Game extends React.Component {
       return;
     }
 
-    /* Enter: submit word during claim. */
-    if (key === "ENTER" && this.state.claim_active) {
+    /* Enter: submit word during claim, or start a claim. */
+    if (key === "ENTER") {
       e.preventDefault();
-      if (this.state.claim_rack.length >= 4) {
-        this.submit_word();
+      if (this.state.claim_active) {
+        if (this.state.claim_rack.length >= 4) {
+          this.submit_word();
+        }
+      } else if (!this.state.claiming && !this.state.claim_player) {
+        this.start_claim();
       }
       return;
     }