Keyboard shortcuts have a complicated issue
What happened?
Freshly installed Zen 1.0.0-a.20 today, and was setting up the keyboard shortcuts. I tried them out several times, even after restarting Zen, but they don't seem to have done/changed anything from the default Firefox keymap.
examples:
- Set "Open New Tab" to ⌃-T (ctrl-T) instead of the default ⌘-T (cmd-T)
- Keybind is still ⌘-T (cmd-T)
- Set "Open New Private Window" to ⌃-⇧-N (ctrl-shift-N) instead of the default ⌘-⇧-P (cmd-shift-P)
- Keybind is still ⌘-⇧-P (cmd-shift-P)
I do have the "Disable Zen Browser's default keyboard shortcuts" option checked, which I would assume just turns off the Zen-defined default keymap and wouldn't affect the user-bindings I'm defining just below that option. If, instead, that checkbox is meant to enable or disable Zen's key-re-map system as a whole, then perhaps a rename is in order for the clarification.
Reproducible?
- [X] I have checked that this issue cannot be reproduced on Mozilla Firefox.
Version
1.0.0-a.20 (64bit)
Severity impact
Low
What platform are you seeing the problem on?
macOS - Intel
Relevant log output
No response
The checkbox disables Firefox's default keymap. There's no way for me to know what action is linked to what shortcut, meaning that overriding creating a new tab won't remove the old one.
I discovered more about this, and the keybinds system needs some work.
Seeing this issue: https://github.com/zen-browser/desktop/issues/226, I was trying to think what was going on under the hood.
When setting a keybind with Ctrl, it registers as "Ctrl", but to use "Ctrl"-based binds, the user needs to press Cmd. However, the reverse is not true, Setting a keybind with Cmd registers as "Meta", but to use "Meta", the user still presses Cmd.
Shift and Alt, fortunately, work as-expected.
So to make that last part is clear, I'll reference screenshots
I set the below keybind by pressing Ctrl-\ when focused in the keybind-box. But to actually use it, I would need to press Cmd-\.
I set the below keybind by pressing Cmd-\. To use it, I would still press Cmd-\.
So the Ctrl key is not usable for keybindings on Mac.
Additionally, there appear to be some issues with certain keys. Tab, as an example, although it does register as "Tab" when setting the keybind, activates when "T" is pressed with the paired modifier. Setting "Ctrl-Tab" to cycle tabs is activated by pressing "Cmd-T" (which acts in combination with the above Cmd/Ctrl bit). This seems to affect the following keys, where the first letter of the key's registered name is considered, but not the actual key:
- Tab (activated by pressing "T", not Tab)
- Caps Lock (activated with "C", not Caps Lock)
- Escape (activated with "E", not Escape)
- Delete (registers as "Backspace", activated with "B", not Delete)
- Return (registers as "Enter", activated with "E", not Return)
- any of the F-Keys (activated with "F")
- any arrow key (activated by "A", for all of them, not the actual arrow)
Since these are being activated by the wrong keys, these also override any Firefox-/Zen-/User-defined keybinds that are set with the matching "activated with" key (Alt-Tab overrides earlier-defined Alt-T bindings.)
I should also add: the checkbox saying to "disable the default keybinds" doesn't work
I should also add: the checkbox saying to "disable the default keybinds" doesn't work
How so?
I should also add: the checkbox saying to "disable the default keybinds" doesn't work
How so?
If the intended implementation is to disable the default Firefox/Zen keybinds, then with that checked and having no user-defined keybinds, then there should be no keybinding-interaction with Zen that isn't system-defined (like Cmd-C to Copy, Cmd-A to Select All), correct?
But with the box checked and having no user-keybinds, I still have working default keybinds like Cmd-W to close a tab, Cmd-T to open a new tab, Cmd-B to open the bookmark sidebar, etc.
ok, ill look into it
Update: The "disable the default keybinds doesn't work" thing may be Mac-only. I've downloaded Zen on my Pop_OS desktop now, and it does seem to respect the checkbox, having only the user-keymap (if defined) when checked.
Additionally, there appear to be some issues with certain keys. Tab, as an example, although it does register as "Tab" when setting the keybind, activates when "T" is pressed with the paired modifier. Setting "Ctrl-Tab" to cycle tabs is activated by pressing "Cmd-T" (which acts in combination with the above Cmd/Ctrl bit). This seems to affect the following keys, where the first letter of the key's registered name is considered, but not the actual key:
- Tab (activated by pressing "T", not Tab)
- Caps Lock (activated with "C", not Caps Lock)
- Escape (activated with "E", not Escape)
- Delete (registers as "Backspace", activated with "B", not Delete)
- Return (registers as "Enter", activated with "E", not Return)
- any of the F-Keys (activated with "F")
- any arrow key (activated by "A", for all of them, not the actual arrow)
Additional keys to add to this, when using a full-style keyboard:
- Home (activated with "H', not Home)
- End (activated with "E", not End)
- Insert (registers as "Help", activated with "H", not Insert)
- Delete (Not the typical Backspace key as mentioned above, the one in the small 6-key-grouping next to Insert and End: activated with "D", not Delete)
- PageUp/PageDown (both are activated with "P", not their respective key)
- NumLock (Registers as "Clear", activated with "C", not NumLock)
- That extra "menu" key on the right-side modifier-group (registers as "ContextMenu", activated with "C", not that key)
Should we worry to much about CapsLock, NumLock, and Menu? Probably not. But they should either not register since they have special purposes, or register correctly.
disable the default keybinds doesn't work doesn't disable all due to how firefox registers the shortcuts
Should be fixed with version 1.0.0-a.38.
Should be fixed with version
1.0.0-a.38.
Only partial fix for CMD shortcuts, more fixes coming soon.
Closing as being aggregated in #1363