fix: update selection on mousedown in question prompt #9780
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
dialog-select.tsx(lines 287-291)onMouseDownhandlers updatestore.selectedbeforeonMouseUptriggersselectOption()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
onMouseOverdoesn't fire when clicking an unfocused terminal, sostore.selectedretains the stale value from before unfocus.Solution
Add
onMouseDownhandlers to update the selection beforeonMouseUptriggers the selection action. This ensures the clicked option is selected regardless of terminal focus state. This pattern is already used indialog-select.tsx.Changes
onMouseDownhandler to regular option boxes inquestion.tsxonMouseDownhandler to the "custom answer" option box inquestion.tsxTesting
dialog-select.tsxChecklist