Suggestion menu appears when clicking on potential mention
See original GitHub issueWhat’s the bug you are facing?
Clicking an incomplete mention causes the suggestion menu to appear.
How can we reproduce the bug on our side?
- Go to the mention example on the tiptap website: https://tiptap.dev/examples/suggestions
- Type
@win
and thenesc
. Do not complete the extention. - Type something else after
- Click on
@win
(may need to click twice) - Mention menu will appear
https://user-images.githubusercontent.com/9100467/161542187-153c6d08-ee8f-4364-abc4-d808a1cb268a.mp4
Can you provide a CodeSandbox?
No response
What did you expect to happen?
After a user indicates they do not want to mention (e.g. they hit esc
) the mention should act as plain text.
Anything to add? (optional)
This is particularly confusing because it happens when the editor is not in editable
mode.
Did you update your dependencies?
- Yes, I’ve updated my dependencies to use the latest version of all packages.
Are you sponsoring us?
- Yes, I’m a sponsor. 💖
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Right-click context menu keeps popping up in Windows 11/10
According to them, the right-click context menu keeps popping up randomly without pressing the mouse right-click on their Windows PC.
Read more >Use @mention in comments to tag someone for feedback
Assign tasks using @mentions · In the top of the comment, hover over the circle next to Assigned to you. A check mark...
Read more >Building a Custom Right-Click (Context) Menu with JavaScript
Nick Salloum mimics Dropbox and Gmail, building a functioning custom context menu (right-click menu) from scratch with JavaScript.
Read more ><input>: The Input (Form Input) element - HTML
The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide...
Read more >New features available with macOS Ventura. - Apple
Edit strong passwords suggested by Safari to adjust for site‑specific ... When AirPods are connected, an AirPods menu will appear at the top...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had some time to look into this today (separate to the maintainers) and have some comments to add.
Firstly, you’ve actually mentioned two bugs, the second one being that: “suggestions should not be triggered when
editor.isEditable === false
”. Since this was fairly straightforward, I raised a fix for this in https://github.com/ueberdosis/tiptap/pull/2692.Back to the main issue you’ve raised here, the root cause appears to be an underlying design decision of how the suggestions plugin works. My understanding of how it works, is that (when you have an empty selection) it looks backwards in the current text block to see if the text that precedes your cursor matches the rough semantics of
${char}.*
. Since this is reactive, i.e. it waits for change in the editor state, and then tries to decide whether to display the suggestion UI, there’s no mechanism for it to not show the suggestion UI when you select that text again in the future.I’ll let the maintainers weigh in here on how they see suggestions evolving, since any change to this behaviour will likely have flow on impacts to other parts of the UX here. e.g. this would cease to work
https://user-images.githubusercontent.com/38820281/162371171-3858950b-65d0-4137-8df2-54b28d426074.mov
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.