markdown-input icon indicating copy to clipboard operation
markdown-input copied to clipboard

Add setting to disable indent with tab

Open justuswilhelm opened this issue 8 months ago • 0 comments

First of all, I want to thank you for making markdown-input. It's incredibly useful to do precision edits on my Anki cards without having to switch to the HTML editor all the time.

One issue I have is that I'm used to navigating between fields using the Tab key on my keyboard. When I'm inside a markdown-input field, I press Tab to get out, but it indents my input instead.

I believe this here is the responsible code in editor.ts:

      Prec.highest(
        keymap.of([
          ...km,
          ...closeBracketsKeymap,
          ...markdownKeymap,
          ...defaultKeymap,
// here
          indentWithTab,
          ...historyKeymap,
          ...completionKeymap
        ])

The CodeMirror docs say

By default, CodeMirror does not handle the Tab key. This isn't an oversight—it is an intentional decision to make the default configuration pass the "no keyboard trap" criterion of the W3C Web Content Accessibility Guidelines.

Now, this isn't the web of course, so different rules may apply. I believe having making this behavior optional would still be a good solution for people who are used to using the Tab key.

  • Anki version: 24.11
  • markdown-input version: 2.2.3

justuswilhelm avatar Jun 01 '25 23:06 justuswilhelm