MenuBubble: Error in v-on handler: "IndexSizeError: Failed to execute 'setStart' on 'Range'
See original GitHub issueDescribe the bug
using the editor-menu-bubble for adding a Link will result in the following error:
Error in v-on handler: "IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 4294967295 is larger than the node's length (16)."
Steps to Reproduce / Codesandbox Example
Browser: Chrome (Google Chrome, Vivaldi):
<div
class="menububble"
:class="{ 'is-active': menu.isActive }"
:style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`"
>
<form class="menububble__form" v-if="linkMenuIsActive" @submit.prevent="setLinkUrl(commands.link, linkUrl)">
<input class="menububble__input" type="text" v-model="linkUrl" placeholder="https://" ref="linkInput" @keydown.esc="hideLinkMenu"/>
<button class="menububble__button" @click="setLinkUrl(commands.link, null)" type="button">
<icon name="remove" />
</button>
</form>
<template v-else>
<button
class="menububble__button"
@click="showLinkMenu(getMarkAttrs('link'))"
:class="{ 'is-active': isActive.link() }"
>
<span>{{ isActive.link() ? 'Update Link' : 'Add Link'}}</span>
<icon name="link" />
</button>
</template>
</div>
</editor-menu-bubble>
Screenshots

Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:29 (2 by maintainers)
Top Results From Across the Web
Error when trying to use setStart and setEnd on Range ...
Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range': The offset 2 is larger than or equal to the node's length (0). Here is...
Read more >Failed to execute 'setStart' on 'Range': The offset 4294967295 ...
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 4294967295 is invalid. at VeSelectionState.ve.SelectionState.
Read more >Range.setStart() - Web APIs | MDN
The Range.setStart() method sets the start position of a Range.
Read more >#12152 (Failed to execute 'setStart' on 'Range': The offset 2 is ...
In chrome it gives following error. Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 111 is larger than or equal to...
Read more >TextView exception: Failed to execute 'setStart' on 'Range'
The following exception was recorded by our analytics 8 times in the last week, in Chrome: Uncaught IndexSizeError: Failed to execute ...
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
It’s an overflow issue, because
Math.pow(2, 32) - 1 === 4294967295
Looking at the traces quickly, it seems like this function triggers it every time
from
is-1
:https://github.com/ueberdosis/tiptap/blob/3b8ba27cc8871a7b8949fc423a8335edf7f9c3c8/packages/tiptap/src/Plugins/MenuBubble.js#L3-L8
As -1 is truthy, I think you need to use
Math.max(from, 0)
orfrom > 0 ? from : 0
instead.This may be a red herring of course!
If you downgrade to the following build versions and ensure you recompile all of your assets post downgrade, it should solve the issue.
tiptap @1.31.0 tiptap-extensions@1.34.0