Merge pull request #3634 from Dane-Horn/2741-shift-in-typing-infiltration

UI: FIX #2741 Allow using modifier keys inside the typing infiltration
This commit is contained in:
hydroflame 2022-05-13 11:04:11 -04:00 committed by GitHub
commit 4024f6e10f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,9 +37,13 @@ export function BackwardGame(props: IMinigameProps): React.ReactElement {
const [guess, setGuess] = useState("");
const hasAugment = Player.hasAugmentation(AugmentationNames.ChaosOfDionysus, true);
function ignorableKeyboardEvent(event: KeyboardEvent): boolean {
return event.key === KEY.BACKSPACE || (event.shiftKey && event.key === "Shift") || event.ctrlKey || event.altKey;
}
function press(this: Document, event: KeyboardEvent): void {
event.preventDefault();
if (event.key === KEY.BACKSPACE) return;
if (ignorableKeyboardEvent(event)) return;
const nextGuess = guess + event.key.toUpperCase();
if (!answer.startsWith(nextGuess)) props.onFailure();
else if (answer === nextGuess) props.onSuccess();