Search code examples
javascriptmonaco-editorvisual-studio-monaco

How to disable phone keyboard pop-up using Monaco Editor?


On any device, I'd like to have the Monaco Editor as read-only and when using a mobile device and the user clicks into the editor, the mobile keyboard (iOS/Android) shouldn't pop-up. How to do that?

Setting readOnly: true doesn't prevent the keyboard to show.


Solution

  • Setting readOnly with domReadOnly will completely prevent mobile keyboard.

    editor.updateOptions({ readOnly: true, domReadOnly: true })
    

    MonacoEditorPlaygroundLink