Cherry-pick the good stuff from input-per-letter

This commit is contained in:
Lynn 2022-01-14 17:19:42 +01:00
parent 687f2acc22
commit a688c30427
4 changed files with 8 additions and 5 deletions

View file

@ -73,7 +73,9 @@ function Game(props: GameProps) {
setGuesses((guesses) => guesses.concat([currentGuess])); setGuesses((guesses) => guesses.concat([currentGuess]));
setCurrentGuess((guess) => ""); setCurrentGuess((guess) => "");
if (currentGuess === target) { if (currentGuess === target) {
setHint("You won! (Enter to play again)"); setHint(
`You won! The answer was ${target.toUpperCase()}. (Enter to play again)`
);
setGameState(GameState.Won); setGameState(GameState.Won);
} else if (guesses.length + 1 === props.maxGuesses) { } else if (guesses.length + 1 === props.maxGuesses) {
setHint( setHint(
@ -170,7 +172,9 @@ function Game(props: GameProps) {
Give up Give up
</button> </button>
</div> </div>
<table className="Game-rows">{tableRows}</table> <table className="Game-rows" tabIndex={0}>
<tbody>{tableRows}</tbody>
</table>
<p role="alert">{hint || `\u00a0`}</p> <p role="alert">{hint || `\u00a0`}</p>
{/* <p role="alert" className="Game-sr-feedback"> {/* <p role="alert" className="Game-sr-feedback">
{srStatus} {srStatus}

View file

@ -27,7 +27,7 @@ export function Row(props: RowProps) {
<td <td
key={i} key={i}
className={letterClass} className={letterClass}
aria-live="polite" aria-live={isEditing ? "assertive" : "off"}
aria-label={ aria-label={
isLockedIn isLockedIn
? letter.toUpperCase() + ? letter.toUpperCase() +

View file

@ -44,7 +44,7 @@ export function clueWord(clue: Clue): string {
if (clue === Clue.Absent) { if (clue === Clue.Absent) {
return "no"; return "no";
} else if (clue === Clue.Elsewhere) { } else if (clue === Clue.Elsewhere) {
return "yellow"; return "elsewhere";
} else { } else {
return "correct"; return "correct";
} }

View file

@ -3743,7 +3743,6 @@
"neighborhood", "neighborhood",
"fragments", "fragments",
"symbolic", "symbolic",
"wales",
"designated", "designated",
"prescribed", "prescribed",
"electricity", "electricity",