Skip to content
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

Suggestion menu appears when clicking on potential mention #2680

Closed
2 tasks done
grantmagdanz opened this issue Apr 4, 2022 · 6 comments
Closed
2 tasks done

Suggestion menu appears when clicking on potential mention #2680

grantmagdanz opened this issue Apr 4, 2022 · 6 comments
Labels
Info: Stale The issue or pullrequest has not been updated in a while and might be stale Type: Bug The issue or pullrequest is related to a bug

Comments

@grantmagdanz
Copy link

What’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?

  1. Go to the mention example on the tiptap website: https://tiptap.dev/examples/suggestions
  2. Type @win and then esc. Do not complete the extention.
  3. Type something else after
  4. Click on @win (may need to click twice)
  5. Mention menu will appear
Headless.WYSIWYG.Text.Editor.Tiptap.Editor.-.4.April.2022.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. 💖
@grantmagdanz grantmagdanz added the Type: Bug The issue or pullrequest is related to a bug label Apr 4, 2022
@scottsidwell
Copy link

scottsidwell commented Apr 8, 2022

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 #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

TiptapMentionBehaviour.mov

@grantmagdanz
Copy link
Author

@scottsidwell Thank you for the reply and the fix! It's very much appreciated.

Huh, interesting. Thanks for looking into it and that makes sense. I'll see if the maintainers will weigh in. Getting it to not show up when not editable is already a big UX improvement.

@jessicalc
Copy link
Contributor

@scottsidwell Thanks for disaggregating the two issues so succinctly and for fixing the read-only editor behavior!

I'm also interested in hearing about how to let people "opt out" of choosing something from the suggestion menu. Following!

@bdbch
Copy link
Member

bdbch commented May 14, 2022

@jessicalc @grantmagdanz do you think this behaviour should be optional?

As already discussed, the current solution is to check the current Textblock for a specific pattern in front of the current curserPos.

I don't have an exact idea yet where to "store" that a user saw a suggestion menu and decided not to use it.

Happily taking suggestions before working on it. 🤞

@stale
Copy link

stale bot commented Jul 13, 2022

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.

@stale stale bot added the stale label Jul 13, 2022
@stale stale bot closed this as completed Jul 20, 2022
@rfgamaral rfgamaral mentioned this issue Sep 15, 2022
10 tasks
@bdbch bdbch reopened this Sep 15, 2022
@bdbch bdbch added this to the 2.0.0 milestone Sep 15, 2022
@bdbch bdbch removed this from the 2.0.0 milestone Feb 23, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jun 12, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Info: Stale The issue or pullrequest has not been updated in a while and might be stale Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

4 participants