Skip to content

Fix exitSuggestions() acting as trigger for other suggestions#7595

Open
oBusk wants to merge 3 commits intoueberdosis:mainfrom
oBusk:exit-suggestion-fix
Open

Fix exitSuggestions() acting as trigger for other suggestions#7595
oBusk wants to merge 3 commits intoueberdosis:mainfrom
oBusk:exit-suggestion-fix

Conversation

@oBusk
Copy link

@oBusk oBusk commented Mar 13, 2026

Changes Overview

Modifies so that suggestion trigger code never runs for a suggestion exit event, even if it's for another suggestion.

Implementation Approach

I wanted to look at how to fix this, added test to verify the issue, then added another global meta to be able to track it. If the global meta is present, skip running trigger check code.

Testing Done

Test verifies that triggering exit on one suggestion-instance does not activate another instance. Tested demos that suggestions still work.

Verification Steps

Verify that exiting suggestions programatically works as expected.

Additional Notes

I wanted to look at if this would be solvable in a nice way, but looking at it, we can't know it's an exit event without knowing about other suggestions, so using a global meta like this was the way I could see. It's not super pretty, understand if we want to say "it's not really a problem" and just close.

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable.
  • I have followed the project guidelines.
  • I have fixed any lint issues.

Related Issues

This would close #7585

Copilot AI review requested due to automatic review settings March 13, 2026 16:02
@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: bf04786

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 72 packages
Name Type
@tiptap/suggestion Patch
@tiptap/extension-emoji Patch
@tiptap/extension-mention Patch
@tiptap/core Patch
@tiptap/extension-audio Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-color Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-font-family Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-node-range Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/pm Patch
@tiptap/react Patch
@tiptap/starter-kit Patch
@tiptap/static-renderer Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-placeholder Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Mar 13, 2026

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit bf04786
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/69b435078e1a840008f6091b
😎 Deploy Preview https://deploy-preview-7595--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue in @tiptap/suggestion where dispatching an exit transaction for one suggestion instance could unintentionally trigger matching/activation logic in other suggestion instances (Issue #7585).

Changes:

  • Add a shared transaction meta flag to mark “exit” transactions and make other Suggestion instances skip match/activation logic for those transactions.
  • Update exitSuggestion() (and internal exit dispatch) to set the shared meta flag.
  • Add an integration test to ensure exiting one suggestion doesn’t activate another, and add a changeset for the patch.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/suggestion/src/suggestion.ts Introduces a shared exit meta flag and short-circuits match logic for non-target Suggestion instances during exit transactions.
packages/suggestion/src/tests/suggestion.test.ts Adds coverage to verify exitSuggestion() won’t re-activate another suggestion instance.
.changeset/violet-crabs-crash.md Adds a patch changeset for the bugfix.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +430 to +432
// unchanged so we don't accidentally activate from the exit transaction.
if (transaction.getMeta(SUGGESTION_EXIT_META)) {
return prev
'@tiptap/suggestion': patch
---

Fix exitSuggestion for one pluginKey can activate another suggestion pluginKey
@bdbch bdbch changed the base branch from develop to main March 14, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing suggestions programmatically can trigger other

2 participants