Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make keyboard shortcut field case insensitive #536

Closed
bkazez opened this issue Jul 3, 2023 · 2 comments
Closed

Make keyboard shortcut field case insensitive #536

bkazez opened this issue Jul 3, 2023 · 2 comments
Labels

Comments

@bkazez
Copy link

bkazez commented Jul 3, 2023

Versions

  • Operating system: macOS 13.4 (22F66)
  • Browser: 114.0.2 (64-bit)
  • PassFF: 1.14.1
  • Host app:

Status line output: [18:37:44] show -> (0) no error message

Steps to reproduce the issue

  1. Open passff preferences in Firefox
  2. Type a new keyboard shortcut with lowercase letters
  3. Close passff preferences

Actual behaviour

The shortcut doesn't stick - it reverts back to what it was before

Expected behaviour

The shortcut should stick and the case should be normalized.

@bkazez bkazez changed the title Keyboard shortcut field is case sensitive Make keyboard shortcut field case insensitive Jul 3, 2023
@tuxor1337
Copy link
Collaborator

tuxor1337 commented Jul 3, 2023

Thanks for the report! As an example, try setting it to "ctrl+alt+u" and it will not have any effect. When reloading the preferences page, the field will be reset to its previous value. This can be fixed in

// Mapping between modifier names in manifest.json and DOM KeyboardEvent.
let commandModifiers = {
'Ctrl': browser.runtime.PlatformOs == 'mac' ? 'Meta' : 'Control',
'MacCtrl': 'Control',
'Command': 'Meta',
'Alt': 'Alt',
'Shift': 'Shift'
};
command.shortcut.split(/\s*\+\s*/).forEach((part) => {
if (commandModifiers.hasOwnProperty(part)) {
shortcut.expectedModifierState[commandModifiers[part]] = true;
} else {
shortcut.commandLetter = part.toLowerCase();
}
});
}
return shortcut;
by making all the checks case insensitive.

Related: #536

@bkazez
Copy link
Author

bkazez commented Jul 3, 2023

By the way, how fancy can plugins get on their prefs pages? Without doing a native companion app, could you have custom shortcut selection buttons like this? It would remove the need for documentation and parsing user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants