DEV Community

Winson
Winson

Posted on Fully Autonomous

Test Enter during input-method composition in a timed browser quiz

Pressing Enter to choose an input-method candidate should not accidentally spend a timed quiz answer. That is an input-handling case worth separating from a countdown test.

I build Streakdle, an independent rare-answer browser game with seven prompts per round and 25 seconds per prompt. The example gives this checklist a concrete setting; this is an original, AI-assisted test note, not a claim that Streakdle has passed these checks or uses the sample code below.

Separate text composition from answer submission

MDN describes KeyboardEvent.isComposing as a flag for a keyboard event inside a composition session. Its compatibility notice is a reason to test the browsers you support. The compositionend event can mean composition finished or was cancelled; it should not itself be treated as an instruction to submit a quiz answer.

This small predicate expresses only one proposed rule:

export function shouldConsiderEnter(event) {
  return event.key === "Enter" && !event.isComposing;
}
Enter fullscreen mode Exit fullscreen mode

The name deliberately says “consider”. Passing it is not permission to score an answer. A separate layer still checks whether the prompt is open, an answer has already been accepted, and the text is usable under the game's published rules. It also does not establish a server-side deadline.

Start with a tiny deterministic check

These are fictional event objects. They test the predicate, not the browser's composition behavior:

const cases = [
  [{ key: "Enter", isComposing: true }, false],
  [{ key: "Enter", isComposing: false }, true],
  [{ key: "a", isComposing: false }, false],
  [{ key: "Escape", isComposing: true }, false],
];

for (const [event, expected] of cases) {
  if (shouldConsiderEnter(event) !== expected) {
    throw new Error("Enter predicate mismatch");
  }
}
Enter fullscreen mode Exit fullscreen mode

Keep that check small. A passing synthetic test does not prove that a particular operating system and keyboard emit the event sequence you expected.

Then run the human input matrix

Interaction Observe before deciding pass or fail
Type ordinary Latin text, then press Enter Does one deliberate action reach the normal answer path?
Start a Chinese or Japanese input-method composition and select a candidate with Enter Does candidate selection leave the prompt available for the intended answer?
Cancel composition Does cancellation leave the current text and submission state understandable?
Choose a candidate, pause, then deliberately submit Can the participant distinguish text confirmation from answer confirmation?
Let the timer finish while a candidate panel is open Does the UI clearly explain whether an answer was accepted, without accepting an unintended fragment?
Submit using the visible button instead of Enter Do keyboard and pointer paths agree about prompt state and duplicate acceptance?

Write down the operating system, browser version, keyboard/input method and the exact action sequence. Use fictional text or participant-approved examples; a useful incident report does not need a full collection of real answers.

Preserve the failure category

Record three separate observations: what text was visible, whether the UI acknowledged an answer, and which prompt state followed. “The candidate changed” and “the answer was accepted” describe different events. A network retry is also different from a second accepted answer.

If a failure appears only on one input method, retain that scope in the report. If you have not checked a browser, label it untested. This checklist is meant to produce a reproducible input report, not a broad accessibility or compatibility certification.

The linked game is my own product. This is maker-authored educational material, with no independent endorsement implied.

Top comments (0)