Cursor sometimes not move or just move-reback with flicker on macOS

Hi, all.

I meet some strange editor behavior on macOS.

OS: macOS Big Sur, v11.6
Browser: Chrome 96.0
ProseMirror: newest version
Operate tool: touchpad, not mouse, with setting `single click` ==> `touch lightly`

Normally, when I click somewhere in editor, the cursor should also move to the same position. But the actual situation on macOS is the cursor sometimes not move or just move-reback with flicker.

2021-12-08 09.16.53

After some tests, I found that if I click by actual click the touchpad (not touch lightly), the cursor works as expected…

Update: I test this with borrowed mouse (mac), the cursor works fine.

Has anyone ever been in a similar situation? Any hint is welcomed.

Never seen that before. Does this also happen in the editor on prosemirror.net?

Nope. The official one works fine.

@philippkuehn Ah. I find the reason. :joy:

this.dom = document.createElement('div');

this.pmView = new EditorView(this.dom, {
  state,
  plugins,
});

// I want the editor focused when I click some side menu.
// So I add the below code..
// And, remove below code will fix this problem
this.dom.addEventListener('click', () => {
  this.pmView.focus();
});

我遇到过光标循环的问题,移动到元素的开头了,再往左移动应该跳到前面去,结果会跳到这个元素的结尾,貌似选区的识别有问题