Tab accessibility on v5

Hi,

The way CM6 handle tab is really nice : CodeMirror Language Config Example

Is it possible to do the same on CM5 ? Maybe there is a plugin ?

Thanks !

After some search and try, I will probably be able to mirror this behaviour by using these method :

editor.setOption("extraKeys", {
  Tab: null
});
editor.setOption("extraKeys", {
  Tab: false
});
editor.setOption("extraKeys", {
  Esc: function(){}
});

I will post my final code when it’s finished.

Here the code. Here is an exemple compatible with the fullscreen addon, but it’s easy to adapt it if you don’t use the fullscreen addon.

      let editor = CodeMirror(document.body, {
      extraKeys: {
        "F11": function (cm) {
          cm.setOption("fullScreen", !cm.getOption("fullScreen"));
        },
        "Esc": function (cm) {
          if (cm.getOption("fullScreen")) {
            cm.setOption("fullScreen", false);
          } else { // the user pressed the escape key, now tab will tab to the next element for accessibility
            if (!cm.state.keyMaps.some(x => x.name == 'tabAccessibility')) {
              cm.addKeyMap({
                'name': 'tabAccessibility',
                'Tab': false,
                'Shift-Tab': false
              });
            }
          }
        }
      }
    });

    editor.on('focus', function (cm) { // On focus, make tab add tabb in editor
      cm.removeKeyMap('tabAccessibility');
    });