This is awesome!
Just noticed that Ctrl-/ isn’t toggling comments in Firefox or Chrome (Windows).
This is awesome!
I too can’t get a bunch of the keyboard shortcuts to work in chrome (ChromeOS 64).
Thanks for pointing this out! Just checked and we’re mapping the
Cmd-/ keyMap, but that doesn’t automatically change to
Ctrl-/ on Windows. I’ll work on a fix to this issue to get our Windows compatibility back - sorry about that.
Cmd-/ for commenting code lines doesn’t work for me either (Chrome 86 on Mac). Does anyone else still have this issue?
I have a German keyboard and cmd+shift+ß actually works, thanks for mentioning it!
This is one of those shortcuts that can save a lot of time, so it would be good if they can be made consistent somehow or if the help menu in Observable would list alternatives for other keyboard layouts depending on browser language.
I took a quick look at ways to map key codes to keyboard characters, and … oh boy.
What I’ve gathered so far for the “/” character:
- There are two keycodes, 111 (numpad divide) and 191 (forward slash).
- CodeMirror maps keycodes to key names.
- All shortcuts in CodeMirror are defined through key names, e.g. “Cmd-/”.
- The rules for key codes in browsers are incredibly complex (and inconsistent), and are the reason that entering “?” (shift-ß) on a German keyboard produces the keycode
In short, I’m not sure if it’s actually feasible to document language-specific shortcuts.
On my setup (Ubuntu, laptop French keyboard without Numpad, Firefox), Ctrl+Shift+/ does not work.
Alternative setups where it works:
- use an external USB (French) keyboard with a Numpad, or
- use Chromium instead of Firefox
But I really would love to be able to toggle comments with my default setup!
On a Mac, this is a Firefox/Chrome bug. Not sure about other platforms.
This may be helpful:
My suggested workaround would be: make up your own keyboard layout that pretends to be US-ANSI but otherwise behaves in a way that matches your own typing preferences. Support for international keyboards has all kinds of unpleasant edge cases in a variety of different software.
Thanks. I imagine the discussion will now occur on Commenting/uncommenting code in non-english keyboard layouts? · Issue #7 · observablehq/feedback · GitHub.