# Wrong cursor position in chromium version less than 106.x

**URL:** <https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976>\
**Category:** Show\
**Created:** [October 23, 2022, 4:14am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976 "2022-10-23T04:14:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matrixbirds](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matrixbirds/32/2958_2.png) [@Matrixbirds](https://discuss.prosemirror.net/u/Matrixbirds)\
**Post date:** [October 23, 2022, 4:14am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/1 "2022-10-23T04:14:27Z")

</div>

Set two inline item with contenteditable=false.

Then try to move the cursor in middle position. The cursor will display in the end of line, but the expect is to display in the middle position. Try to typing or trigger edit character it will add character in correct position, So I guess, it seems chromium’s bug.

I find the work around way, need use zero-width no-break space/ zero-width space and append it after or before every contenteditable=false element. But the space character will be mixed when pm trigger text input. It will bypass the pm selection system, and cause selection bug.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [October 25, 2022, 10:30am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/2 "2022-10-25T10:30:00Z")

</div>

This is a known Chrome bug. Does Chrome 106 fix it? If so, that’d be great news.

---

<div class="post-metadata">

**Author:** ![Matrixbirds](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matrixbirds/32/2958_2.png) [@Matrixbirds](https://discuss.prosemirror.net/u/Matrixbirds)\
**Post date:** [October 25, 2022, 10:37am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/3 "2022-10-25T10:37:39Z")

</div>

It verified on my macbook. But I m working in low version chromium environments. Now, I’m stumbled in the old version of chromium environment. Did you have any idea to patch zero-width no-break space to hack the behaviour make cursor correct?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [October 25, 2022, 10:49am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/4 "2022-10-25T10:49:40Z")

</div>

Using an `<img>` without an `src` attribute also seems to work, and causes less problems with ‘leaking’ of characters into the document text.

---

<div class="post-metadata">

**Author:** ![Matrixbirds](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matrixbirds/32/2958_2.png) [@Matrixbirds](https://discuss.prosemirror.net/u/Matrixbirds)\
**Post date:** [October 30, 2022, 12:23pm UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/5 "2022-10-30T12:23:13Z")

</div>

Yep, Prosemirror did handle this. I’m digging the `prosemirror-view` source code and find method named `addHackNode`, It seems only add hack node for the last child of parent. In my case, there are many contenteditable=false elements, their will cause wrong cursor issue in chromium version less than 106.x. I think we need extend the `addHackNode` to support wrapper around the every contenteditable=false element to make the cursor correct.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [October 31, 2022, 8:48am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/6 "2022-10-31T08:48:54Z")

</div>

Adding such behavior at this point would be too disruptive. ProseMirror expects the authors of widgets to add their own hacks (in the form of internal zero-width spaces or CSS) to work around these Chrome issues.

---

<div class="post-metadata">

**Author:** ![Matrixbirds](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matrixbirds/32/2958_2.png) [@Matrixbirds](https://discuss.prosemirror.net/u/Matrixbirds)\
**Post date:** [October 31, 2022, 9:56am UTC](https://discuss.prosemirror.net/t/wrong-cursor-position-in-chromium-version-less-than-106-x/4976/7 "2022-10-31T09:56:24Z")

</div>

Did you have any demo can extend widget. I know the decoration widget, but i don’t know which way is good for prosemirror.
