<p dir="auto">Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="208225279" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/8703" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/8703/hovercard" href="https://github.com/electron/electron/issues/8703">#8703</a> describes exactly the problem. It is duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="108162592" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/2895" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/2895/hovercard" href="https://github.com/electron/electron/issues/2895">#2895</a> but is much more clearly described. The problem is that it is closed but is not resolved.</p>
<ul dir="auto">
<li>Electron version: 1.4.15</li>
<li>Operating system: macOS Sierra, Windows 10</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Top level menu items should be hidden when the <code class="notranslate">visible</code> property is false and not be clickable when <code class="notranslate">enabled</code> property is false.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">The <code class="notranslate">visible</code> and <code class="notranslate">enabled</code> properties do not behave correctly on top level menu items. It seems to work correctly for submenu items.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Create a menu with this code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const { Menu } = require('electron').remote;

const template = [
  {
    label: 'Should not be visible',
    visible: false,
    submenu: [
      {
        label: 'Should not be visible either',
        visible: false
      }
    ]
  },
  {
    label: 'Should not be enabled',
    enabled: false,
    submenu: [
      {
        label: 'Should not be enabled either',
        enabled: false
      }
    ]
  },
];

const menu = Menu.buildFromTemplate(template);

Menu.setApplicationMenu(menu);"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-kos">{</span> Menu <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">remote</span><span class="pl-kos">;</span>

<span class="pl-k">const</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">label</span>: <span class="pl-s">'Should not be visible'</span><span class="pl-kos">,</span>
    <span class="pl-c1">visible</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">submenu</span>: <span class="pl-kos">[</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">label</span>: <span class="pl-s">'Should not be visible either'</span><span class="pl-kos">,</span>
        <span class="pl-c1">visible</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-kos">,</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">label</span>: <span class="pl-s">'Should not be enabled'</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-c1">submenu</span>: <span class="pl-kos">[</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">label</span>: <span class="pl-s">'Should not be enabled either'</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-kos">,</span>
<span class="pl-kos">]</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">menu</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-v">Menu</span><span class="pl-kos">.</span><span class="pl-en">setApplicationMenu</span><span class="pl-kos">(</span><span class="pl-s1">menu</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Both menu items will still be visible and clickable.</p>