fix(user-input): atomic chip selection, modifier-key handling, and stale overlay ghost#4902
fix(user-input): atomic chip selection, modifier-key handling, and stale overlay ghost#4902waleedlatif1 wants to merge 9 commits into
Conversation
…ale overlay ghost
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Mention chips behave as atomic units across more gestures: expanded Reviewed by Cursor Bugbot for commit 31c66fa. Configure here. |
… ranged selections
Greptile SummaryThis PR fixes three distinct behavioral bugs in the home chat
Confidence Score: 5/5Safe to merge — the changes are scoped to client-side selection handling and layout for a single input component, with no data model or API surface changes. The three bug fixes are logically sound: the selection-snap heuristic correctly infers edge direction from lastSelectionRef, the deferred setSelectionRange reads direction at apply time, the modifier-key guards accurately enumerate every passthrough case, and the single-scroller layout eliminates the JS scroll-sync that caused the stale overlay. No correctness issues or regressions were found on any code path examined. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[onSelect / onMouseUp fires] --> B[Read start, end from DOM]
B --> C[Update lastSelectionRef]
C --> D{textarea.value === valueRef?}
D -- No --> E[adoptDomValue → re-render]
E --> Z[return]
D -- Yes --> F{start === end?}
F -- Yes collapsed --> G{inside chip?}
G -- No --> M[syncMentionState / syncSlashState]
G -- Yes --> H[snap to nearest chip edge]
H --> N[setTimeout: setSelectionRange]
N --> Z2[return — sync runs on re-fire]
F -- No ranged --> I[findRangeContaining start and end]
I --> J{singleEdgeMoved?}
J -- Yes --> K[Shrinking edge → snap inward\nGrowing edge → absorb chip]
J -- No fresh select --> L[Expand both edges outward]
K --> O{newStart > newEnd?}
L --> O
O -- Yes --> P[Collapse to newEnd]
O -- No --> Q{newStart or newEnd changed?}
P --> Q
Q -- Yes --> N
Q -- No --> M
M --> R[return]
Reviews (5): Last reviewed commit: "refactor(user-input): native co-scroll f..." | Re-trigger Greptile |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1a2e63f. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6997d3e. Configure here.
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7c3e298. Configure here.
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5b02798. Configure here.
|
@cursor review |
|
@greptile review |
| ? startRange.end | ||
| : startRange.start | ||
| : start | ||
| newEnd = endRange ? (singleEdgeMoved && end < prev.end ? endRange.start : endRange.end) : end |
There was a problem hiding this comment.
Stale selection ref after typing
Medium Severity
lastSelectionRef is only refreshed in handleSelectAdjust on select/mouseup, but caret moves from ordinary typing do not fire those events. The ranged chip snap logic then compares the new selection to a prev from an earlier click or from before submit, so the first Shift+arrow (or similar) grow/shrink after typing can mis-classify the gesture and snap chip edges to the wrong boundary.
Reviewed by Cursor Bugbot for commit 31c66fa. Configure here.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
1 issue from previous review remains unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 31c66fa. Configure here.


Summary
Type of Change
Testing
Tested manually (selection matrix: select-all, drag grow/shrink, shift-arrow grow/shrink across chips, cmd+shift jumps, double-click, click-in-chip caret snap). Typecheck and lint pass.
Checklist