Auto complete don't work on mobile

Author: ghostCreated Aug 17, 2023Updated Jun 30, 2025

Hi, I am facing problem in code mirror on mobile, I tried to enable auto complete but ot doesn't work, I saw that I have to "Ctrl-Space" to activate it but in mobile we don't have "Alt" key, but in this link :

The auto complete works on the first code of block on mobile, How to do this?

As a brief:

auto complete don't work on mobile

I use a webview for android
And I used JavaScript and it's my code for webview:
<!DOCTYPE html>
<html>
<head>

<link rel="stylesheet" href="lib/codemirror.css">

</head>
<style>
    #myTextArea {
  width: 100%;    /* Take up 100% of available width */
  height: 100vh;  /* Take up 100% of viewport height */
  border: none;   /* Remove border for seamless appearance */
}

</style>
<body>
  <!-- Your CodeMirror initialization code will go here -->
  <!-- Inside the <body> section of codemirror.html -->
    <textarea id="codeEditor"></textarea>

<script>
//var myTextArea = document.getElementById("myTextArea");

var codeMirror = CodeMirror(document.getElementById("codeEditor"), {
  mode: "javascript",
  lineNumbers: true,
  theme: "darcula",
  extraKeys: {
    "Space": "autocomplete"
  },
  hintOptions: {
    completeSingle: false,
    alignWithWord: true,
    closeCharacters: /[\s()\[\]{};:>,]/
  }
});
document.addEventListener("DOMContentLoaded", function() {
  var codemirror = document.querySelector(".CodeMirror");
  codemirror.CodeMirror.setOption("extraKeys", {
    "Enter": function(cm) {
      cm.showHint({ hint: CodeMirror.hint.auto });
    }
  });
});
</script>
      <script src="src/codemirror.js"></script>
      <script src="mode/javascript/javascript.js"></script>
      <script src="addon/hint/show-hint.js"></script>
      <script src="addon/hint/javascript-hint.js"></script> <!-- For JavaScript autocomplete -->
</body>
</html>