fix(drag-handle): fix Vue 3 drag handle disappearing during external state updates#7472
Conversation
|
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the Vue 3 drag handle implementation where drag handles disappear when state is updated externally from @nodeChange events. The fix removes the initial visibility: 'hidden' style from the drag handle element, allowing the DragHandlePlugin to manage visibility entirely through its showHandle() and hideHandle() functions.
Changes:
- Removed
visibility: 'hidden'from the initial inline style of the drag handle div element in the Vue 3 implementation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ref: root, | ||
| class: props.class, | ||
| style: { visibility: 'hidden', position: 'absolute' }, | ||
| style: { position: 'absolute' }, |
There was a problem hiding this comment.
This is a user-facing bug fix that requires a changeset. According to the project guidelines (see DEVELOPMENT.md), you should run pnpm changeset to create a changeset file describing this fix. The changeset should mention that this fixes the drag handle disappearing issue when state updates occur externally from @nodeChange events in Vue 3, as described in issue #7471.
|
Possible duplicate #7252 - identified in my PR. Issue has been around some time? |
Changes Overview
While fixing a related issue in nuxt-ui (nuxt/ui#5960) which uses tiptap, I noticed the Vue 3 DragHandle would disappear when its state is updated and causes external re-renders/changes.
I reproduced the issue in Tiptap and opened #7471 with a minimal example in the demo for vue drag handles. Using DOM breakpoints, I traced the issue to the drag handle’s initial visibility: hidden style being reapplied during reactive state updates.
Removing this initial style allows the DragHandlePlugin to fully control visibility without regressions.
Implementation Approach
The fix removes the initial visibility: hidden style from the Vue 3 drag handle element.
Visibility is now managed exclusively by the DragHandlePlugin via its existing showHandle() and hideHandle() logic.
This aligns the DOM behavior with the plugin’s intended state management and avoids conflicts with external reactive updates.
Testing Done
Verification Steps
Bug Branch also works as expect (with example for external state):
develop...solidprinciples:tiptap-draghandle-state-update-bug:bug/drag-handle
Bug repro + fix branch:
develop...solidprinciples:tiptap-draghandle-state-update-bug:bug/drag-handle
Additional Notes
This PR fixes a bug in the Vue 3 drag handle implementation where drag handles disappear when state is updated externally from @nodeChange events. The fix removes the initial visibility: 'hidden' style from the drag handle element, allowing the DragHandlePlugin to manage visibility entirely through its showHandle() and hideHandle() functions.
Checklist
Related Issues