palantir/blueprint

HotKey: Can't use NumPad Plus

Open

#3,738 建立於 2019年9月13日

在 GitHub 查看
 (3 留言) (5 反應) (0 負責人)TypeScript (20,263 star) (2,167 fork)batch import
P2Package: coreType: bughelp wanted

描述

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.

貢獻者指南