Stay organized with collections
Save and categorize content based on your preferences.
blockly > ShortcutRegistry > removeKeyMapping
ShortcutRegistry.removeKeyMapping() method
Removes a mapping between a keycode and a keyboard shortcut.
Signature:
removeKeyMapping(keyCode: string, shortcutName: string, quiet?: boolean): boolean;
Parameters
Parameter |
Type |
Description |
keyCode |
string |
The key code for the keyboard shortcut. If registering a key code with a modifier (ex: ctrl+c) use ShortcutRegistry.registry.createSerializedKey; |
shortcutName |
string |
The name of the shortcut to execute when the given keycode is pressed. |
quiet |
boolean |
(Optional) True to not console warn when there is no shortcut to remove. |
Returns:
boolean
True if a key mapping was removed, false otherwise.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eremoveKeyMapping\u003c/code\u003e method removes the association between a key code and a keyboard shortcut.\u003c/p\u003e\n"],["\u003cp\u003eIt requires the key code and shortcut name as parameters, and optionally accepts a boolean to suppress console warnings.\u003c/p\u003e\n"],["\u003cp\u003eIt returns \u003ccode\u003etrue\u003c/code\u003e if the mapping was successfully removed, and \u003ccode\u003efalse\u003c/code\u003e otherwise.\u003c/p\u003e\n"]]],["The `removeKeyMapping` method in `ShortcutRegistry` removes a keycode-to-shortcut mapping. It requires the `keyCode` (e.g., 'ctrl+c') and the `shortcutName`. An optional `opt_quiet` parameter suppresses console warnings if no shortcut is found. The method returns `true` if a mapping is removed and `false` otherwise. `ShortcutRegistry.registry.createSerializedKey` can be used for registering key codes with modifiers.\n"],null,["[blockly](./blockly.md) \\\u003e [ShortcutRegistry](./blockly.shortcutregistry_class.md) \\\u003e [removeKeyMapping](./blockly.shortcutregistry_class.removekeymapping_1_method.md)\n\nShortcutRegistry.removeKeyMapping() method\n------------------------------------------\n\nRemoves a mapping between a keycode and a keyboard shortcut.\n\n**Signature:** \n\n removeKeyMapping(keyCode: string, shortcutName: string, quiet?: boolean): boolean;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|--------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| keyCode | string | The key code for the keyboard shortcut. If registering a key code with a modifier (ex: ctrl+c) use ShortcutRegistry.registry.createSerializedKey; |\n| shortcutName | string | The name of the shortcut to execute when the given keycode is pressed. |\n| quiet | boolean | *(Optional)* True to not console warn when there is no shortcut to remove. |\n\n**Returns:**\n\nboolean\n\nTrue if a key mapping was removed, false otherwise."]]