-
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
Ensure mentions suggestions are displayed when clicking textarea #6730
Conversation
|
553a263
to
35197ac
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6730 +/- ##
=======================================
Coverage 99.42% 99.43%
=======================================
Files 270 270
Lines 10194 10196 +2
Branches 2433 2433
=======================================
+ Hits 10135 10138 +3
+ Misses 59 58 -1 ☔ View full report in Codecov by Sentry. |
35197ac
to
3456e01
Compare
}; | ||
// When clicking the textarea it's possible the caret is moved "into" a | ||
// mention, so we check if the popover should be opened | ||
listenerCollection.add(textarea, 'click', checkShouldOpenPopover); |
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.
Does this work if you move the caret with long-press on mobile?
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. Let me check.
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.
Nop, it doesn't 😢. Let me check what's the right event for that.
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.
Looks like it's selectionchange
. I'm going to create another task to address this once the overall solution is more advanced, as I expect more event handlers to be needed.
I'll adjust on the right combination for different device types and interactions then.
3456e01
to
750ab84
Compare
This PR ensures the mention suggestions popover is displayed if clicking the textarea causes the caret to move "into" an at-mention.
Previously this was checked only when the caret's position changed as a result of pressing a key.
Before:
suggestions-on-click-before-2024-12-20_11.58.38.mp4
After:
suggestions-on-click-after-2024-12-20_11.57.50.mp4
Implementation rational
At first I tried to address this by listening to
selectionchange
event as suggested in this comment, however, it had some problems:keyup
listener just for that particular key.selectionchange
caused the popover to be closed and then immediately open again.That's why I ended up leaving the existing
keyup
listener in combination withclick
.