-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display suggestions popover when at-mentioning #6727
Conversation
anchorElementRef={textareaRef} | ||
classes="p-2" | ||
> | ||
Suggestions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary placeholder
b397746
to
0ac0205
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6727 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 269 270 +1
Lines 10175 10194 +19
Branches 2427 2433 +6
=======================================
+ Hits 10116 10135 +19
Misses 59 59 ☔ View full report in Codecov by Sentry. |
62c5232
to
412f14c
Compare
|
||
// We listen for `keyup` to make sure the text in the textarea reflects the | ||
// just-pressed key when we evaluate it | ||
listenerCollection.add(textarea, 'keyup', e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggestions popup does not currently appear if the caret is repositioned by clicking in the middle of a mention. I haven't checked, but I'd guess that also applies to using the caret movement UIs on mobile. I think that's fine for this PR but you could instead use the selectionchange
event. The downside is that I don't think that event provides a way to determine why the selection changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. There's another thing to take into consideration actually, which is that the popover is closed when clicking away, so I'll probably try to address that separately to try different combinations and even handlers.
4bd2815
to
07dc484
Compare
07dc484
to
07ebc15
Compare
This PR adds logic to display a suggestions popover when an
@mention
is typed in the annotations text. The popover is displayed as long as the text right before the caret looks like a mention, and hidden otherwise.The logic takes the
at_mentions
feature flag into consideration, disabling the logic entirely otherwise.suggestions-popover-2024-12-16_15.55.45.mp4
Out of scope
This PR only covers the logic to decide when to show/hide the popover, but it does not:
Those will be implemented in follow-up PRs.
Test steps
at_mentions
@mention
. The popover should be displayed under the textarea.@mention
. The popover should be closed.TODO
@mention
.