vimium
vimium copied to clipboard
Escape key doesn't work (firefox)
The extension doesn't react to the escape key in any context, thus making it impossible to exit to normal mode or to cancel an action.
- press f, then press escape
- expected: hints are removed, the page goes back to normal mode
- actual: nothing happens, the page stays in the link selection mode
Same with visual selection, vomnibar, etc; escape key doesn't work in any context.
Note that the browser only receives the key UP event for the escape key, not the key down event. I wonder if that has something to do with it. I've tested it in tridactyl too, same behavior. Any ideas?
Mozilla Firefox 68.9.0esr Vimium 1.66
Works as inteded with a fresh profile. The problem is profile-specific. Still keeping it open in case someone encountered a similar problem.
Could you do a simple test to find what Vimium got?
- open https://gdh1995.cn/vimium-c/keyboard-test.html
- click Vimium's icon and save options to make Vimium disabled on the page
- reload the page, and enable "disable Vimium / Vimium C / VimFx"
- then press Escape to see what it will log.
@gdh1995 keyup only for escape, whether the extension is disabled or not. It makes no difference if it's enabled or disabled in regards to the escape key events.
As a side note, I noticed sometimes I get key up events from normal navigation keys (j, k, etc) too when I press them in a quick succession. Unrelated, but curious maybe.
Then this is an issue of Firefox itself, or does another extension hook the keydown events?
I've only been able to reproduce the issue with firefox and with a single specific profile that I use. In this profile, neither vimium nor tridactyl receive the escape key. On a fresh profile however both extensions work fine.
Of course, I've tried disabling every other extension except for vimium, but that doesn't affect the issue; so I can't pinpoint the cause, and I'm not sure what else I can try to find the cause. Some kind of about:config switch that affects escape key behavior?.. I'm running out of ideas.
Is it possible to remap (via config) at least some of the "unfocus"/"return to normal mode" commands to another key? E.g. make it so pressing space exits the link selection mode? Or make C-[ do the same, as it does in vim?
EDIT: seems like the answer is no, it's all hardcoded (via isEscape
), e.g.:
https://github.com/philc/vimium/blob/4c45726c0c05eb5381ab58d9ce629972e801eb43/content_scripts/mode_find.js#L58
You may use <c-[>
, and it works like <esc>
at most places (when no map <c-[> someCommand
).
And KeyboardUtils.isEscape
supports mapkey <anykey> <c-[>
in key mappings.
Oh, C-[
is supposed to work out of the box? It doesn't work for me. On https://gdh1995.cn/vimium-c/keyboard-test.html I see that the key down events gets "eaten" by vimium when it's enabled, but it produces absolutely no effect.
The mapkey trick however works! mapkey <c-g> <c-[>
makes C-g work like escape in all relevant contexts. I find it to be quite weird, since C-[ itself doesn't work at all. Any ideas about what's happening?
Also, I noticed that as a workaround I can use backspace in link selection mode and find mode (but not in vomnibar).
What will the test page log for Ctrl+[
on your Firefox when Vimium is disabled?
keydown control keyup [ keyup control
...well, which is exactly the same as when it's enabled :/ Same happens for C-], but for C-S-[ (aka C-{
) or C-' or ctrl + any alphanumerics the behavior is normal (both key down and key up events are displayed for both ctrl and the second key). I'm quite confused, it seems like firefox specifically treats escape, ctrl+[ and ctrl+] in a weird way.
EDIT: alt+[ and shift+[ also work as intended; so far I'm unable to find any keys or combinations that behave weirdly beside these 3
Just noticed this is happening to me when trying to escape from github's finder feature. Vimium is eating the esc
somehow: the problem resolves when using a blank rule to disable Vimium. Keycodes are as expected for esc
and C-[
I have the exact same issue. The keydown event for the Escape key isn't being registered on e.g https://w3c.github.io/uievents/tools/key-event-viewer.html. Troubleshoot mode (safe mode = all extensions disabled) doesn't fix it, but creating a new profile does. I also suspected something in about:config, but nothing stood out. Very strange!
Had the issue that 'esc' was not working and only 'c-esc' exited modes as expected. Problem was solved for me after resetting "permissions.default.shortcuts" in about:config, which I have seem to changed a while back :) Maybe this helps someone in the future...
Had the issue that 'esc' was not working and only 'c-esc' exited modes as expected. Problem was solved for me after resetting "permissions.default.shortcuts" in about:config, which I have seem to changed a while back :) Maybe this helps someone in the future...
This fixed it for me too! Thank you!
Unfortunately this was a very useful setting, because it prevented websites like Twitter and Github from hijacking keys. But it shouldn't have interferred with the Esc keypress events. It could be a bug in Firefox.
During my tests on Firefox 122, Win11, keydown#key=Escape
will be blocked by permissions.default.shortcuts=2
, while Ctrl+[
and Ctrl+]
works as intended.
@gdh1995 is absolutely right. I had the same issue for a long time, and this is exactly what the problem was: permissions.default.shortcuts
set to 2
is about:config
(which means to block websites from overriding keys by default).
And for reference, it doesn't just block the Escape key for Vimium, but for ALL Firefox extensions (i.e Ublock Origin's zapper/picker for instance).
We need to contact Mozilla about this as this is a huge issue for keyboard-centric users on Firefox.