palantir/blueprint

HotKey: Can't use NumPad Plus

Open

#3,738 opened on Sep 13, 2019

View on GitHub
 (3 comments) (5 reactions) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P2Package: coreType: bughelp wanted

Description

Environment

  • Package version(s): 3.18.1
  • Browser and OS versions: Chrome Windows 10

If possible, link to a minimal repro: https://codesandbox.io/embed/serene-sara-g4umn

Steps to reproduce

Use "plus" as a key in a Hotkey

Actual behavior

The plus key by the numpad doesn't work for hotkeys

Expected behavior

The plus key by the numpad works for hotkeys.

Possible solution

The plus key is unique on qwerty keyboards because it is on the keyboard twice and one of them is a shift key and the other is not. That isn't true on my keyboard with any other key.

When parsing the key combination of "plus", hotkeyParser.ts looks up whether it is a shift key and replaces it with the non-shifted key and adds the modifier so it replaces plus with equals and adds the shift modifier.

An easy fix would be to add a new name for the numpad plus that has the same key code of 107, but is not present in the ShiftKey lookup table so that it doesn't get replaced with "shift + =". That would force devs to have a hotkey for each plus.

More invasive solutions might involve having parseKeyCombo return an array of keyCombos instead of a single keyCombo, or writing some special logic just for plus.

Contributor guide