keepassxc-browser icon indicating copy to clipboard operation
keepassxc-browser copied to clipboard

Cannot change keyboard shortcuts in Firefox on macOS

Open beingmrkenny opened this issue 5 years ago • 12 comments

Expected Behavior

  1. Visit /options/shortcuts.html in keePass options
  2. Click input field that contains the shortcut (e.g. MacCtrl+Shift+u)
  3. Press new shortcut
  4. Shortcut is saved

Current Behavior

Input field remains empty, or is briefly filled with a character like È, no shortcut is recorded, and no new shortcuts are saved.

Possible Solution

Seems like a JS problem, possibly to do with not recognising which key has been pressed, but I haven't been able to look into it in depth.

Steps to Reproduce (for bugs)

See expected behaviour

Debug info

No error messages returned in console

KeePassXC-Browser Version: 1.5.4 KeePassXC Version: 2.5.3 Operating system: macOS 10.14.6 Browser: Firefox 73.0

beingmrkenny avatar Feb 18 '20 14:02 beingmrkenny

This probably because of the keyboard layout, and I'm not sure if there's anything we can do about it. What shortcuts gives you È and what's your layout?

varjolintu avatar Feb 18 '20 14:02 varjolintu

British layout. Checking this again, I only get accented characters etc with the alt key, which I wouldn't use for a shortcut. Using the ctrl key works as expected.

I would like to use the cmd key, which on macos is used like ctrl is on other systems. Trying to use the command key causes the bugs detailed above.

Is it possible to use the cmd key?

beingmrkenny avatar Feb 18 '20 15:02 beingmrkenny

AFAIK with Firefox using Cmd with extension keyboard shortcuts is not possible.

varjolintu avatar Feb 18 '20 15:02 varjolintu

1Password seems to manage it, but it might be registering the keypress via the app that runs outside of the browser.

beingmrkenny avatar Feb 18 '20 20:02 beingmrkenny

Only keyboard shortcut with 1PasswordX I see is Cmd+Period which is used as a "Activate extension". It's a different thing.

varjolintu avatar Feb 18 '20 21:02 varjolintu

There's cmd+/, which has the same effect as "fill with username and password". This is 1Password that comes with the app from the app store, presumably 1PasswordX works differently.

If I clone the keepasscx-browser to take a look locally, will it still work with my local database?

beingmrkenny avatar Feb 18 '20 22:02 beingmrkenny

Yes, you can clone the repo and load it as a temporary extension. No building or anything special needed.

varjolintu avatar Feb 19 '20 05:02 varjolintu

I have similar problems too. Typing Cmd+] the screen updates, but when I try to save I get "Error: Shortcut for fill_username_password has not been changed!". Even more maddening, is that sometimes I type (say "}") and the screen flashes with the character and then becomes empty.

FFox v73 OSX 10.13.6 International Keyboard (The top row is ~!@#$%^&*()_+ which is above the keys `1234567890-= ) KPXC: 2.5.3 KPXC-Browser: 1.5.4 I can concur that 1Password6 & 7 can autofill using Cmd+\ It works well.

No idea how to type the È other than typing E (shift+E) and holding for a few secs and then use the mouse.

cmroanirgo avatar Feb 24 '20 06:02 cmroanirgo

We are talking about browser extension shortcuts here. As you can see these shortcuts are related to the desktop application.

You can see all the supported keys for browser extension custom shortcuts here: https://developer.chrome.com/extensions/commands (the same API is used in Firefox)

varjolintu avatar Feb 24 '20 06:02 varjolintu

This is about browser extension (including 1Password). Even your iink clearly shows that it's the browser extension that uses Cmd+\ .

Command‑Backslash () | Fill Login on current web page. Requires the 1Password extension.

I disabled the global auto type (in the KPXC), because it didn't work in firefox and tried to use the same hotkey Cmd+] in the browser instead. Result: fail (& failed with any attempt at different shortcut). It's interesting about the keyboard restrictions in Web Extensions...

EDIT: There's a project (https://github.com/philc/vimium) that allows vim style keyboard entry in the browser, clearly bypassing the WebExtensions 'commands'. From a rough glance it seems that a content script is injected and the keyboard listening is done there. There is also a firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1215061) that mentions it's possible that the popup also has access to all keyboard strokes (but getting back to the content page is tricky).

cmroanirgo avatar Feb 24 '20 10:02 cmroanirgo

This is about browser extension (including 1Password). Even your iink clearly shows that it's the browser extension that uses Cmd+\ .

This is not about the browser extension. The page clearly says those are Global keyboard shortcuts for the application itself. Probably they just pass the command from the desktop application to the extension which does the filling.

I disabled the global auto type (in the KPXC), because it didn't work in firefox and tried to use the same hotkey Cmd+] in the browser instead. Result: fail (& failed with any attempt at different shortcut). It's interesting about the keyboard restrictions in Web Extensions...

In short, Web Extensions must also use modifier keys, so only Ctrl/Alt or Ctrl+Shift/Alt+Shift are accepted with the additional key.

EDIT: There's a project (https://github.com/philc/vimium) that allows vim style keyboard entry in the browser, clearly bypassing the WebExtensions 'commands'. From a rough glance it seems that a content script is injected and the keyboard listening is done there. There is also a firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1215061) that mentions it's possible that the popup also has access to all keyboard strokes (but getting back to the content page is tricky).

Of course it's possible to inject identical method, but at this point we are not overriding browser's own shortcuts.

varjolintu avatar Feb 24 '20 12:02 varjolintu

Same goes for Chrome indeed - tried to set the Command+\ as I had in 1Password I've escaped from (so I suggest to rename the title of this Issue to mention Chrome as well).

It would be cool to have more flexible shortcut options as I dunno when/if I'll be able to override the many years of muscle memory...

aism avatar Apr 02 '22 18:04 aism