How do we prevent keyboard displaying on mobile devices

Hi Marijn,

I have been using ProseMirror to build a web based editor for mobile browsers, but I didn’t find a way to prevent keyboard displaying when not necessary. For example if I click on one of my Nodeviews, I usually do not want the keyboard to display. I found out when click on a Nodeview ProseMirror will trigger maybe a ‘focus’ on the dom and then the system keyboard will be displayed. Is there a way to prevent this? Thanks.

1 Like

No, that’s how the editor works—node selections focus it, so that you can interact with the editor through the keyboard when you have such a selection. You could override clicks to do something else, but the default behavior is to focus and select.

@PatrickHai I don’t know of the side effects, but perhaps targeting the specific NodeView and using preventDefault will help? Just a shot in the dark.

@PatrickHai You need to remove focus from Prosemirror when you click on your Nodeview. I think this will help you.

if (document.activeElement) {
     document.activeElement.blur()
}