Skip to content

feat(ui): select answers first and confirm on a subsequent click - #1275

Open
yeerliin wants to merge 1 commit into
Gentleman-Programming:mainfrom
yeerliin:feat/1273-two-step-choice-click
Open

yeerliin wants to merge 1 commit into
Gentleman-Programming:mainfrom
yeerliin:feat/1273-two-step-choice-click

Conversation

@yeerliin

@yeerliin yeerliin commented Sep 20, 2026

Copy link
Copy Markdown

Summary

Refs #1273. Submitted as a draft proposal for maintainer review; issue approval and merge remain maintainer decisions.

  • The first completed click selects an answer, including the initially highlighted row; a subsequent click on the same row confirms it.
  • Clicking another answer only selects it. There is no double-click timing window, popup, extra button, or device detection.
  • Enable this behavior only for ask_user_choice; profiles retain single-click behavior and keyboard navigation/Enter remain unchanged.
  • Consume pending pointer confirmation on keyboard confirmation, covering Other → Enter → Escape → select again.

Implementation

File Change
lib/native-choice-list.ts Add an opt-in second-click confirmation mode, separate from highlighted selection.
extensions/ask-user-choice.ts Opt answer rows into two-step confirmation.
tests/native-choice-list.test.ts Cover completed gestures, selection changes, keyboard interaction, and default single-click behavior.
tests/ask-user-choice.test.ts Cover answer submission, custom entry, and mixed pointer/keyboard interaction.

Validation

  • Behavioral TDD: original regressions failed before implementation; the mixed-input regression also failed before its correction.
  • node --experimental-strip-types --test tests/native-choice-list.test.ts tests/ask-user-choice.test.ts: 23 passed, independently rerun.
  • pnpm run typecheck: baseline gate passes, 196 recorded diagnostics with no regressions.
  • git diff --check: passes.
  • Contributor reports successful manual interaction tests using both an isolated local extension and normal Pi startup with that extension enabled.

Known validation limits

  • Full pnpm test timed out after 600 seconds with multiple failures and no final totals. These failures have not all been established as pre-existing.
  • tests/gentle-ai.test.ts: 69 passed, 1 failed. The isolated profile-path sanitization fixture fails while creating a Windows directory containing control characters, before the assertion; the fixture and profile implementation are unchanged by this PR.
  • Physical mobile/Herdr validation was not performed. Default list behavior is covered, but no dedicated profile-panel pointer test was added.
  • An already pointer-selected answer can still be confirmed accidentally by a later click on the same row; this reduces accidental submissions rather than eliminating them.

Only the four source/test files are included. Local test activation settings and development notes are excluded.

Summary by CodeRabbit

  • New Features

    • Choice lists can require a second click to confirm a selection.
    • First clicks select an item without submitting it; clicking the same item again confirms it.
    • Keyboard confirmation continues to confirm selections immediately.
    • Pointer and keyboard interactions now behave consistently when switching selections or opening custom responses.
  • Tests

    • Added coverage for single-click and two-click confirmation modes.
    • Added interaction tests for keyboard navigation, cancellation, rendering, and custom response editing.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: cc240301-6cf8-434d-9ad9-189d791afc48

📥 Commits

Reviewing files that changed from the base of the PR and between 40e9135 and 42ded37.

📒 Files selected for processing (4)
  • extensions/ask-user-choice.ts
  • lib/native-choice-list.ts
  • tests/ask-user-choice.test.ts
  • tests/native-choice-list.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The native choice list adds optional second-click confirmation. Pointer confirmation state resets during selection changes and keyboard actions. The user-choice extension enables this mode, with tests covering pointer, keyboard, rendering, and cancellation behavior.

Changes

Choice confirmation

Layer / File(s) Summary
Native choice-list confirmation behavior
lib/native-choice-list.ts
Adds NativeChoiceListOptions, tracks pending pointer selections, clears pending state when selection context changes, and confirms rows according to pointer or keyboard input.
User-choice extension integration
extensions/ask-user-choice.ts, tests/ask-user-choice.test.ts
Enables confirmOnSecondClick and tests native hit testing plus the Other-row pointer and keyboard interactions.
Native choice-list confirmation tests
tests/native-choice-list.test.ts
Tests default and second-click modes, repeated clicks, row changes, rendering, Enter confirmation, keyboard navigation, and Escape cancellation.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: decode2

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: answer rows now require an initial selection followed by a subsequent click for confirmation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yeerliin
yeerliin marked this pull request as ready for review September 20, 2026 19:53
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.

1 participant