-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Decrease Font Size keyboard shortcut throws error if command is disabled #3030
Comments
@lkcampbell -- I think you can fix it by removing its displayKey (line 161 in base-config\keyboard.json) which is using unicode minus character as its shortcut. And I would like to know whether the issue is on Windows only or or Mac only or both platforms. We can consider on fixing it in native shell if we decide to keep using unicode minus character. |
for me on windows i get errors for all three shortcuts when no document is open and i found a quick fix for the errors because the Command execute function returns undefined if the Command is disabled i fixed this by adding return (new $.Deferred()).reject().promise() |
I'm on Windows 7 and the problem does go away when I edit keyboard.json per your suggestion. I'm not seeing the problem with the other shortcuts. |
I don't see any issue with the other two as well. I'm seeing a new issue after removing displayKey. Now Decrease font size is also showing its shortcut as Ctrl++ (same as Increase font size). So we have to fix the issue in native shell (at least on Windows). |
this is weird i merged you branch in the current master to test it and still get the errors i'll try to merge again to see if i made any merge errors or something like that |
it seems that i get this additional errors because of my german keyboard layout where i have 0 + - 2times, on the Num block they all throw an error, and the other ones only the Ctrl-- logs an error. |
Nice discovery! I can reproduce it with numpad; so it has nothing to do with German keyboard layout. And your solution to fix it from CommandManager execute method is the right way to go. My suggestion of removing the displayKey won't fix the issue if the user uses keys from numpad. So please go ahead and fix it. I'll review your pull request when you submit it. |
FBNC to @lkcampbell |
Confirmed fix. Thanks! |
Background:
I discovered this problem while working on another bug fix for adjusting font sizes. See the discussion at #3027.
Repro Steps:
Observed Behavior:
A message is printed in the Dev Tools console: "Uncaught TypeError: Cannot call method 'state' of undefined."
Expected Behavior:
Nothing should happen. The shortcut keys for Increase Font Size (Ctrl-+) and Restore Font Size (Ctrl-0) do nothing. The shortcut key for Decrease Font Size shoud act the same.
The text was updated successfully, but these errors were encountered: