Thanks to visit codestin.com
Credit goes to github.com

Skip to content

window menubar click event handler still buggy (buggy since 0.12) #4777

@jonwwilkes

Description

@jonwwilkes
  1. Run the code below:

package.json:

{
  "name": "helloworld",
  "main": "index.html"
}

index.html:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  <script>
    var menu = new nw.Menu({type: 'menubar'});

    var submenu_one = new nw.Menu();

    submenu_one.append(new nw.MenuItem({
      label: 'Item A',
      click: function() { console.log("Item A"); }
    }));

    submenu_one.append(new nw.MenuItem({
      label: 'Item B',
      click: function() { console.log("Item B"); }
    }));

    var submenu_two = new nw.Menu();

    submenu_two.append(new nw.MenuItem({
      label: 'Item C',
      click: function() { console.log("Item C"); }
    }));

    submenu_two.append(new nw.MenuItem({
      label: 'Item D',
      click: function() { console.log("Item D"); }
    }));

    var submenu_three = new nw.Menu();

    submenu_three.append(new nw.MenuItem({
      label: 'Item F',
      click: function() { console.log("Item F"); }
    }));

    submenu_three.append(new nw.MenuItem({
      label: 'Item G',
      click: function() { console.log("Item G"); }
    }));

    menu.append(new nw.MenuItem({
      label: 'First Menu',
      submenu: submenu_one
    }));

    menu.append(new nw.MenuItem({
      label: 'Second Menu',
      submenu: submenu_two
    }));

    menu.append(new nw.MenuItem({
      label: 'Third Menu',
      submenu: submenu_three
    }));

    nw.Window.get().menu = menu;
  </script>
  </head>
  <body>
    <h1>Hello World!</h1>
  </body>
</html>
  1. Click "ctrl-shift-i" to bring up devtools, and click "Console" to show the console.
  2. In the main window click "First Menu" and release the mouse button. It should bring up the submenu.
  3. Without clicking the mouse again, move the mouse to hover over "Third Menu". It should show the submenu for "Third Menu".
  4. In the submenu, click "Item F".

Bug! It should print out "Item F" to the console, but it doesn't print. The click callback function isn't getting called.

Operating System: Windows 7 (But it also has happened on Ubuntu 14.04, Debian Jessie, and
arch. Haven't check OSX yet...)

Version: 0.14.2 SDK x64 for Windows
Reproducible case: see above

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions