Closed totorofly closed 12 months ago
instead of using interactive
, u can use manual trigger https://vue-tippy.netlify.app/props#trigger or set hideOnClick
to false
Here's the part of my Vue component code where the issue is:
<template>
<node-view-wrapper>
<tippy
ref="tippyInstance"
arrow
:hide-on-click="false"
interactive
placement = 'left'
theme="sidebar-bubble-toolbar"
:inertia="true"
>
<!-- ... -->
<template #content>
<tippy
arrow
interactive
:hide-on-click="false"
:inertia="true"
placement = "left"
theme="sidebar-bubble-toolbar"
animation="shift-away"
:duration="[450, 250]"
:onMount = "handleHoverStart"
:onUntrigger = "handleHoverEnd"
>
<!-- ... -->
<template #content>
<side-tool-bar
v-show = "isHovered"
:hide-button-list="['history','bold','italic','underline','strike']"
style="border: 0px solid blue;padding: 0;"
:editor="editor"
:posFrom="posFrom"
:nodeViewProps="props"
:categoryOrder="['heading','text-align','mark']"/>
</template>
</tippy>
</template>
</tippy>
</node-view-wrapper>
</template>
This is a screenshot showing the behavior before modification:
I tried removing the interactive attribute from the first tippy component, and changed the trigger to 'mouseenter focus'. This is how it looks after the modification:
```Upon investigation, it seems the issue arises from the selectVertically function in prosemirror-view. This function seems to handle vertical cursor movement, but it doesn't consider tiptap's NodeView components that contain elements beyond node-view-content.
function selectVertically(view: EditorView, dir: number, mods: string) {
let sel = view.state.selection
if (sel instanceof TextSelection && !sel.empty || mods.indexOf("s") > -1) return false
if (browser.mac && mods.indexOf("m") > -1) return false
let {$from, $to} = sel
if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) {
let next = moveSelectionBlock(view.state, dir)
if (next && (next instanceof NodeSelection))
return apply(view, next)
}
if (!$from.parent.inlineContent) {
let side = dir < 0 ? $from : $to
let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir)
return beyond ? apply(view, beyond) : false
}
return false
}
I believe this function is causing the issue because it does not accommodate for the structure of a NodeView that contains more than just the node-view-content.
I've found the solution to the issue I was encountering. As it turns out, the solution was available in the official documentation all along. The fix is to add contenteditable="false" to the elements outside of the node-view-content.
This attribute tells the browser that the content of the node-view-content should not be editable by the user. By adding this attribute, the issue with the cursor not moving up and down as expected has been resolved.
Hello,
I'm currently using VueTippy in combination with a rich text editor (Tiptap), and I'm encountering some issues due to the way Tippy handles events when the interactive option is set to true.
As I understand, when interactive is true, Tippy will prevent certain events, including keyboard events, from propagating in order to prevent the tooltip from disappearing when the mouse moves out of it. However, in my use case, I need the tooltips to stay visible when the mouse moves into them (i.e., I need interactive to be true), but I don't want Tippy to block keyboard events.
This is causing issues in my application because it prevents the arrow keys from working properly in the Tiptap editor whenever a Tippy tooltip is visible. Specifically, the keyboard events are blocked and the cursor doesn't move as expected.
I wonder if it would be possible to add finer control over the event handling for the interactive option in Tippy. Specifically, it would be helpful to have separate controls for whether Tippy should prevent mouse events and keyboard events. This would allow users to keep tooltips interactive with mouse movements, while still allowing keyboard events to propagate as needed.
Thank you for your consideration.