palantir/blueprint

HotKey: Can't use NumPad Plus

開放

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

 (3 則留言) (5 個反應) (0 位負責人)TypeScript (2,167 個分叉)batch import
P2Package: coreType: bughelp wanted

倉庫指標

星標
 (20,263 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南