kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Enter on a button inside a Perseus exercise checks the answer instead of activating it

Open rtibblesbot opened this issue 1 week ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: release-v0.20.x

Observed behavior

  • In a Perseus exercise, Tab onto any key of the on-screen keypad (digits, operators, function and letter keys) and press Enter: nothing is inserted into the math field.
  • The same Enter checks the field's current contents as an answer, so a partial expression is recorded as a wrong attempt.
  • Space on the same key inserts it.
  • The renderer root catches Enter for every descendant, keypad included: PerseusRendererIndex.vue#L8 (@keydown.enter.prevent="answerGiven"). The keypad's Close button already opts out with @keydown.native.enter.stop.
  • Other buttons and links in an item take the same path: Enter on a hint's explanation toggle, or on a definition word (once #16054 lands, e.g. polígono), records an incorrect answer before the control opens on keyup. So do dropdown openers, label-image markers and the image zoom button.
  • Answer controls (choice toggles, categorizer inputs, Grapher type buttons, math fields) rely on this Enter shortcut to check the answer.

Expected behavior

  • Enter on a keypad key presses that key, as Space does, and does not check the answer.
  • A maintainer decides which controls keep the Enter-checks-the-answer shortcut; every other control gets its own Enter activation and records no attempt.

User-facing consequences

  • Keyboard learners who activate buttons with Enter cannot build an answer from the keypad, and each attempt records an incorrect answer in their attempt history and in coach reports.

Steps to reproduce

  1. Sign in as a learner and open an exercise with an expression answer, e.g. a derivatives quiz item f(x) = cos x.
  2. Click the answer field; the keypad opens.
  3. Tab to the sin key, press Space: sin() appears in the field.
  4. Tab to the x key, press Enter.
  5. x is not inserted, a PUT /api/logger/trackprogress/<id>/ is sent, and an ✕ appears in the attempt history.

Explanation and definition triggers:

  1. Import Kolibri QA Channel (95a52b386f2c485cb97dd60901674a98) and sign in as a learner.
  2. Open Geometría > Identifica figuras, Q1 ("¿Cuáles de las siguientes figuras son cuadriláteros?") and take hint 1.
  3. Tab to polígono and press Enter.
  4. The answer is checked and an incorrect attempt is recorded before the definition opens.

Context

  • Kolibri at 4bea0818d7 (#15968's branch); the same handler is on release-v0.20.x at 5e76129d17.
  • Chromium (Playwright), Linux.

Acceptance Criteria

  • [ ] Enter on any on-screen keypad key inserts the same thing Space does, on fraction and expression keypads.
  • [ ] Enter on a keypad key sends no trackprogress request and adds no attempt.
  • [ ] The set of controls that keep the Enter shortcut is decided and recorded on this issue.
  • [ ] Enter on the explanation toggle, a definition word, a dropdown opener, a label-image marker and the zoom button activates it and sends no trackprogress request.
  • [ ] Enter on each control in the decided set still checks the answer once.

AI usage

Claude Code found this during automated manual QA of #15968, reproduced it in the running app, and drafted this issue.

rtibblesbot avatar Nov 24 '26 22:11 rtibblesbot

The same root @keydown.enter.prevent="answerGiven" catches Enter on every button and link in an item, not only keypad keys; #15968's keypad opt-out leaves these.

  • Enter on a hint's explanation toggle, or on a definition word (once #16054 lands), records an incorrect answer before the control opens on keyup.
  • Dropdown openers, label-image markers and the image zoom button take the same path.
  • Answer controls (choice toggles, categorizer inputs, Grapher type buttons, math fields) rely on the shortcut, so which controls keep it needs a maintainer's decision.

Reproduction (release-v0.20.x at e3b074b70f plus #16061, Chromium, Linux):

  1. Import Kolibri QA Channel (95a52b386f2c485cb97dd60901674a98) and sign in as a learner.
  2. Open Geometría > Identifica figuras, Q1 and take hint 1.
  3. Tab to polígono and press Enter.
  4. An incorrect attempt is recorded before the definition opens.

Found while fixing #16054 and reproduced in Jest on its branch.


Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Nov 26 '26 12:11 rtibblesbot