Selection vanishes when view is not editable

Was it an implicit behaviour of prosemirror that it will not show browser selection when view is not editable or could be some bug . I am using czi-prosemirror . I am not sure if a plugin should be written to enable browser selection . Some how the selection just vanishes , i see code in prosemirror-view does flush and from and to points to -1 in that and the selection gets removed. Any pointers ?

That’s not intended behavior. If you can demonstrate it with a plain ProseMirror instance (no 3rd-party wrapper and libraries), I can try to debug it.

Thanks Marijn .Before i create a non 3rd party one , i just did a trial and error . The browser selection works till prosemirror-view 1.8.9 , but doesnt after moving to 1.9.0 or latest.

Steps to reproduce …

git clone https://github.com/chanzuckerberg/czi-prosemirror.git
npm install
npm run start

Open http://localhost:3001/?readonly you should be able to double select on any text …

Now to reproduce
npm install prosemirror-view@1.9.0 Open http://localhost:3001/?readonly you should not be able to double click to select on any text…

Let me try to create a plain prosemirror one …

I think its due to the wrappers , some dispatchtransaction suppressing the event . Let me try to figure out.

I just encountered this today, maybe. It can be resolved by setting user-select: text, I believe.

I don’t see the problem in a plain ProseMirror instance set to be uneditable, so it does seem to be related to the context.

Thanks marijn , its a state persistence issue , the selection state is not given back to the editor in readonly mode in my case . Fixed it.