<ul dir="auto">
<li>Electron version: 1.4.15</li>
<li>Operating system: OSX 10.12.2</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">MenuItem with role should be disabled when a set a menuItem with <code class="notranslate">enabled:false</code></p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">MenuItem with role are not disabled whereas a MenuItem without role is correctly disabled</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">I made a small repo that shows the bug : <a href="https://github.com/jbleuzen/electron-menu">https://github.com/jbleuzen/electron-menu</a></p>
<p dir="auto">If you have any questions... :)</p>
<ul dir="auto">
<li>Electron version: 1.1.0</li>
<li>Operating system: MacOS</li>
</ul>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
var template = [{
        accelerator: 'CmdOrCtrl+Z',
        click: function (item, win) {
        },
        enabled: false
    },
    {
        accelerator: 'CmdOrCtrl+Y',
        click: function (item, win) {
        },
        enabled: false
    },
    {
        accelerator: 'CmdOrCtrl+X',
        role: 'cut',
        enabled: false
    },
    {
        accelerator: 'CmdOrCtrl+C',
        role: 'copy',
        enabled: false
    },
    {
        accelerator: 'CmdOrCtrl+V',
        role: 'paste',
        enabled: false
    },
    {
        accelerator: 'CmdOrCtrl+A',
        role: 'selectall',
        enabled: false
    }]

contextMenu = Menu.buildFromTemplate(template);
contextMenu.popup(BrowserWindow.getFocusedWindow());"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">template</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+Z'</span><span class="pl-kos">,</span>
        <span class="pl-en">click</span>: <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">item</span><span class="pl-kos">,</span> <span class="pl-s1">win</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+Y'</span><span class="pl-kos">,</span>
        <span class="pl-en">click</span>: <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">item</span><span class="pl-kos">,</span> <span class="pl-s1">win</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+X'</span><span class="pl-kos">,</span>
        <span class="pl-c1">role</span>: <span class="pl-s">'cut'</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+C'</span><span class="pl-kos">,</span>
        <span class="pl-c1">role</span>: <span class="pl-s">'copy'</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+V'</span><span class="pl-kos">,</span>
        <span class="pl-c1">role</span>: <span class="pl-s">'paste'</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">accelerator</span>: <span class="pl-s">'CmdOrCtrl+A'</span><span class="pl-kos">,</span>
        <span class="pl-c1">role</span>: <span class="pl-s">'selectall'</span><span class="pl-kos">,</span>
        <span class="pl-c1">enabled</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span><span class="pl-kos">]</span>

<span class="pl-s1">contextMenu</span> <span class="pl-c1">=</span> <span class="pl-v">Menu</span><span class="pl-kos">.</span><span class="pl-en">buildFromTemplate</span><span class="pl-kos">(</span><span class="pl-s1">template</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">contextMenu</span><span class="pl-kos">.</span><span class="pl-en">popup</span><span class="pl-kos">(</span><span class="pl-v">BrowserWindow</span><span class="pl-kos">.</span><span class="pl-en">getFocusedWindow</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Items with defined click, are disabled, others - no.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1834053/15673541/1b1a2646-2740-11e6-9a5c-766347373b18.png"><img width="157" alt="2016-05-31 14 57 37" src="https://cloud.githubusercontent.com/assets/1834053/15673541/1b1a2646-2740-11e6-9a5c-766347373b18.png" style="max-width: 100%;"></a></p>