There was an error while loading. Please reload this page.
1 parent ac1b175 commit b6cb6bfCopy full SHA for b6cb6bf
1 file changed
editor/index.html
@@ -240,15 +240,20 @@
240
if ((e.ctrlKey||e.metaKey) && e.key==='Enter') { e.preventDefault(); runSketch(); }
241
});
242
243
-// Fix Tab in Firefox: intercept on the CM textarea directly
+// Fix Tab in Firefox
244
setTimeout(() => {
245
+ const cmEl = document.querySelector('.CodeMirror');
246
const cmTextarea = document.querySelector('.CodeMirror textarea');
247
+ if (cmEl) cmEl.setAttribute('tabindex', '-1');
248
if (cmTextarea) {
249
+ cmTextarea.setAttribute('tabindex', '0');
250
cmTextarea.addEventListener('keydown', e => {
251
if (e.key === 'Tab') {
252
e.preventDefault();
253
e.stopPropagation();
254
+ e.stopImmediatePropagation();
255
editor.replaceSelection(' ');
256
+ cmTextarea.focus();
257
}
258
}, true);
259
0 commit comments