Skip to content

Conversation

@moaead
Copy link

@moaead moaead commented Jan 21, 2026

What does this PR do?

Fixes question selection click behavior when the terminal is unfocused. Previously, clicking on an option in the middle of the list would select the last hovered option instead of the clicked one.

How did you verify your code works?

  1. The fix follows the exact same pattern already used in dialog-select.tsx (lines 287-291)
  2. Code review: onMouseDown handlers update store.selected before onMouseUp triggers selectOption()

Summary

Fixes #9730

Problem

When the terminal is unfocused and the user clicks directly on a question option (e.g., option 2 or 3), the wrong option gets selected. This happens because onMouseOver doesn't fire when clicking an unfocused terminal, so store.selected retains the stale value from before unfocus.

Solution

Add onMouseDown handlers to update the selection before onMouseUp triggers the selection action. This ensures the clicked option is selected regardless of terminal focus state. This pattern is already used in dialog-select.tsx.

Changes

  • Added onMouseDown handler to regular option boxes in question.tsx
  • Added onMouseDown handler to the "custom answer" option box in question.tsx

Testing

  • Code follows the established pattern from dialog-select.tsx
  • Minimal change: 2 lines modified

Checklist

  • Code follows project style guidelines
  • Tests pass locally (no test runner available without bun)
  • Changes are minimal and focused
  • Linked to issue with 'Fixes #'

When the terminal is unfocused and then clicked, the onMouseUp handler
would use the stale store.selected value from before unfocus. By adding
onMouseDown handlers that update the selection first, the correct option
is selected when clicking.

This follows the same pattern already used in dialog-select.tsx.

Fixes anomalyco#9730
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

Why it might be related:
Both PRs address the same issue (#9730) - fixing question option selection when the terminal is unfocused. PR #9731 appears to be an alternative fix for the exact same problem. These should be reviewed together to determine if one should be closed in favor of the other.

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.

Question selection click selects wrong option when terminal is unfocused

1 participant