Fails
Editor that swallows the Tab key
Live preview
codeEditor.addEventListener("keydown", (event) => { if (event.key === "Tab") { event.preventDefault(); insertAtCursor("\t"); }});
Tab and Shift+Tab always insert a tab character, and nothing tells the user another way out. A keyboard user who enters the editor is stuck there.