Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Menus don't show accurate shortcuts if any shortcuts added/removed directly via KeyBindingManager #964

Closed
peterflynn opened this issue May 31, 2012 · 2 comments
Assignees

Comments

@peterflynn
Copy link
Member

Add this code to an extension, or at the bottom of Menus.init():

    // Bug 1
    KeyBindingManager.addBinding(Commands.FILE_OPEN_FOLDER, "Ctrl-Alt-O");

    // Bug 2
    KeyBindingManager.removeBinding("Ctrl-Q");

    // Bug 3
    var MY_COMMAND_ID = "helloworld.sayhello";
    CommandManager.register("Hello World", MY_COMMAND_ID, function () {
        window.alert("Hello, world!");
    });

    KeyBindingManager.addBinding(MY_COMMAND_ID, "Ctrl-L");

    var menu = Menus.getMenu(Menus.AppMenuBar.FILE_MENU);
    menu.addMenuItem("menu-helloworld-sayhello", MY_COMMAND_ID);

Result:

  1. File > Open Folder does not show any keyboard shortcut (even though pressing the shortcut works)
  2. File > Quit still shows "Ctrl+Q" as its shortcut (even though pressing the shortcut does nothing)
  3. File > Hello World does not show any keyboard shortcut (even though pressing the shortcut works)

To fix (1) & (2), KeyBindingManager needs to dispatch change events and Menus needs to listen to them and update the menu item UI.

To fix (3), KeyBindingManager needs to expose an API for getting the bindings for a specific Command and that Menus needs to call that API when initially constructing the menu item UI, rather than assuming that the only bindings that exist are those that were passed directly to it as args.

@ghost ghost assigned tvoliter May 31, 2012
@jasonsanjose
Copy link
Member

@peterflynn @tvoliter If you guys don't mind, I can look at this one while Ty is out sick.

@ghost ghost assigned jasonsanjose May 31, 2012
jasonsanjose added a commit that referenced this issue Jun 1, 2012
commit 51c1c978163834e3a1b5fb171cb9cbb44d21783b
Author: Jason San Jose <jasonsj@adobe.com>
Date:   Fri Jun 1 13:43:10 2012 -0700

    Implement keyBindingAdded and keyBindingRemoved events

commit f937b2228cc133d578891981db82699cb2a64ea0
Author: Jason San Jose <jasonsj@adobe.com>
Date:   Fri Jun 1 11:17:14 2012 -0700

    Remove keymap

commit 1af5f5887909f682b7da032522f4c93b291becfb
Author: Jason San Jose <jasonsj@adobe.com>
Date:   Thu May 31 16:32:34 2012 -0700

    refactor for  #964

commit 799ca1e
Author: Jason San Jose <jasonsj@adobe.com>
Date:   Thu May 31 12:31:19 2012 -0700

    refactor key descriptor formatting. remove unused dependency.

commit b2c253e
Author: Jason San Jose <jasonsj@adobe.com>
Date:   Thu May 31 11:44:30 2012 -0700

    Supporrt keyboard shortcut display override
@ghost ghost assigned peterflynn Jun 2, 2012
@peterflynn
Copy link
Member Author

Confirmed fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants