greena13 / react-hotkeys

Declarative hotkey and focus area management for React
https://github.com/greena13/react-hotkeys
ISC License
2.15k stars 161 forks source link

[BUG] Configuration.option('_customKeyNamesDict') not set when trying to retreive a custom key with ObserveKeys only property #268

Open kgagnon opened 4 years ago

kgagnon commented 4 years ago

Describe the bug I have a <GlobalHotkeys> component and some hotkeys defined (as strings) and passed to the keyMap property. I then have an Input wrapped with <ObserveKeys> component that has the only property set to ["ctrl+enter"] (which is my hotkey string set in the keyMap)

Expected behavior The editable field wrapped by ObserveKeys should block all hotkeys previously set but one, in our case, ctrl+enter

What happens instead js TypeError when trying to get "_customKeyNamesDict" from the configs @isCustomKeyName.js:9

Platform (please complete the following information):

Include the smallest log that includes your issue: Here is console output:

TypeError: _lib_config_Configuration__WEBPACK_IMPORTED_MODULE_0__.default.option(...) is undefined isCustomKeyName.js:9
    isCustomKeyName isCustomKeyName.js:9
    isValidKey isValidKey.js:29
    keyDictionary withHotKeysIgnoreOverride.js:165
    reduce self-hosted:303
    keyDictionary withHotKeysIgnoreOverride.js:162
    _reloadDictionaries withHotKeysIgnoreOverride.js:113
    _reloadDictionaries self-hosted:876
    React 16
    bind_applyFunctionN self-hosted:1054
    dispatchEvent self-hosted:1018
    unstable_runWithPriority scheduler.development.js:697
    React 4
    dispatchDiscreteEvent self-hosted:977
    focusInput react-select-cac0a5ae.browser.esm.js:1911
    Select react-select-cac0a5ae.browser.esm.js:1373
    React 17
    bind_applyFunctionN self-hosted:1054
    dispatchEvent self-hosted:1018
    unstable_runWithPriority scheduler.development.js:697
    React 4
    dispatchDiscreteEvent self-hosted:977

Setting verbose output won't do anything since it is a fatal error. If anything, I can see my key bound to the handler and that it is correctly set (right before the crash):


"submitConditionForm": [
            {
                "prefix": "",
                "actionName": "submitConditionForm",
                "sequenceLength": 1,
                "id": "Control+Enter",
                "keyDictionary": {
                    "Control": true,
                    "Enter": true
                },
                "keyEventType": 0,
                "size": 2
            }
        ]