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.

贡献者指南