Skip to content

keyboard input controls supported with keymapper - #1450

Merged
JackWilb merged 10 commits into
devfrom
al/1448-keyboard-inputs
Sep 28, 2026
Merged

JackWilb merged 10 commits into
devfrom
al/1448-keyboard-inputs

Conversation

@A7700

@A7700 A7700 commented Sep 1, 2026

Copy link
Copy Markdown

Does this PR close any open issues?

Closes #1448

Give a longer description of what this PR addresses and why it's needed

Custom keyboard controls are not easily accessible in the config files but are really usefull especially when buttons are involved in the questions. Thie PR enables the user to define a mapping or a list in the json to link buttons to keys on the keyboard and on keypress the linked button is selected.

@A7700
A7700 marked this pull request as draft September 1, 2026 07:29
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🪓 PR closed, deleted preview.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d64e57b0e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
@A7700
A7700 marked this pull request as ready for review September 2, 2026 08:39
@A7700 A7700 linked an issue Sep 2, 2026 that may be closed by this pull request

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb254dc26e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
@JackWilb

JackWilb commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Inline key mapping on the options
Use a kbd element on the button (allow hiding with a config prop)
Keystroke vs click logging in track. These need to be logged as keystrokes in trrack (maybe new issue?)
Parser error for invalid key maps (Any combo, with + between, verify that they're valid keys) — need to choose what the valid keys are called, is there some standard? (https://revisit-nsf.slack.com/archives/C03NLALH0JJ/p1788445984338849)

@JackWilb JackWilb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the inline key mapping and the key hints. I rechecked the latest commits and am requesting changes because the current implementation still has a few correctness and accessibility problems:

  • Invalid mappings are warnings, so configs such as "14" still run instead of failing in the parser.
  • Shift+X-style combinations are not implemented consistently between validation and runtime.
  • Shortcuts stop working after a participant focuses a visible option, and multiple visible responses use first-listener-wins ownership.
  • A mapped Enter can also trigger the Next/Check Answer handler.
  • The new Next hint changes the accessible name and is causing current Chromium failures.
  • Keyboard and click changes are still indistinguishable in Trrack.

The inline comments below describe the smallest fixes I think are needed. Please also add integration coverage for focus ownership, mapped Enter, parser failures/combinations, accessible names, and Trrack interaction source.

Comment thread src/parser/parser.ts
Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/ButtonsInput.tsx
Comment thread src/components/response/KeyMapper.tsx
Comment thread src/components/NextButton.tsx Outdated
Comment thread src/components/response/KeyMapper.tsx Outdated
Comment thread src/components/response/ButtonsInput.tsx Outdated
@A7700

A7700 commented Sep 10, 2026

Copy link
Copy Markdown
Author

do not use mantine key elements but instead use some small subtle symbols like copy and collapse symbols on mantine Kbd documentation
image

@JackWilb JackWilb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the keyboard input work. I merged the current dev branch and addressed the review follow-ups:

  • Mapped button selections now record whether they came from a keyboard shortcut or a click in provenance.
  • Config validation rejects Tab shortcuts and Enter shortcuts that conflict with nextOnEnter. Unsupported modifier combinations produce warnings.
  • Focused action buttons retain their normal Enter and Space activation, and shortcut mappings are limited to button options.
  • Removed the unused focus wrapper and kept the updated Stroop test assertions from both branches.

The focused unit tests and Chromium Stroop test passed locally. The pushed commit also passed lint, unit tests, deployment, and all four Chromium CI shards. Approved.

@JackWilb
JackWilb merged commit bb66173 into dev Sep 28, 2026
11 checks passed
@JackWilb
JackWilb deleted the al/1448-keyboard-inputs branch September 28, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support keyboard inputs for buttons

2 participants