<ul dir="auto">
<li>Electron version: 1.3.3</li>
<li>Operating system: Windows</li>
</ul>
<p dir="auto">I'm reopening this issue (see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="117654309" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/3494" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/3494/hovercard" href="https://github.com/electron/electron/issues/3494">#3494</a>). <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zcbenz/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zcbenz">@zcbenz</a> closed it, citing that macOS doesn't support hiding the separator. However; it seems to be working on El Capitan (10.11.16).</p>
<p dir="auto">On OSX, I have a menu that collapses as shown (when a user disables SSL):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/770982/17827362/47bb24f8-6641-11e6-8448-44723a430413.png"><img src="https://cloud.githubusercontent.com/assets/770982/17827362/47bb24f8-6641-11e6-8448-44723a430413.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/770982/17827361/35dfbdfc-6641-11e6-9af6-f515d97dd09e.png"><img src="https://cloud.githubusercontent.com/assets/770982/17827361/35dfbdfc-6641-11e6-9af6-f515d97dd09e.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">On Windows, it looks like this:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/770982/17827418/341bb5ba-6642-11e6-8347-8c2e73d72975.png"><img src="https://cloud.githubusercontent.com/assets/770982/17827418/341bb5ba-6642-11e6-8347-8c2e73d72975.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/770982/17827422/4d6d049c-6642-11e6-9cef-11d0beea1c65.png"><img src="https://cloud.githubusercontent.com/assets/770982/17827422/4d6d049c-6642-11e6-9cef-11d0beea1c65.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">The code responsible for this action looks like:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="sslmenu.items.forEach((item) =&gt; {
  item.visible = assets.CA.enabled
})"><pre class="notranslate"><span class="pl-s1">sslmenu</span><span class="pl-kos">.</span><span class="pl-c1">items</span><span class="pl-kos">.</span><span class="pl-en">forEach</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">item</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-s1">item</span><span class="pl-kos">.</span><span class="pl-c1">visible</span> <span class="pl-c1">=</span> <span class="pl-s1">assets</span><span class="pl-kos">.</span><span class="pl-c1">CA</span><span class="pl-kos">.</span><span class="pl-c1">enabled</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">Clearly, changing the visibility of a separator on OSX works while Windows does not.</p>
<p dir="auto">OS X does this for us, but Windows and Linux does not. There's absolutely no reason to have leading and trailing separators and it's difficult to not introduce leading/trailing separators in complex context menus where multiple actors modify it. Especially when using the <code class="notranslate">visible</code> option to toggle items as the separator is not connected to that. I think Electron should handle this for us.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const electron = require('electron');

electron.app.on('ready', () =&gt; {
    electron.Menu.setApplicationMenu(electron.Menu.buildFromTemplate([{
        submenu: [{
            type: 'separator'
        }, {
            label: 'Foo'
        }, {
            type: 'separator'
        }]
    }]));

    (new electron.BrowserWindow())
        .loadURL(`https://github.com`);
});"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">electron</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-s1">electron</span><span class="pl-kos">.</span><span class="pl-c1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'ready'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-s1">electron</span><span class="pl-kos">.</span><span class="pl-c1">Menu</span><span class="pl-kos">.</span><span class="pl-en">setApplicationMenu</span><span class="pl-kos">(</span><span class="pl-s1">electron</span><span class="pl-kos">.</span><span class="pl-c1">Menu</span><span class="pl-kos">.</span><span class="pl-en">buildFromTemplate</span><span class="pl-kos">(</span><span class="pl-kos">[</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">type</span>: <span class="pl-s">'separator'</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">'Foo'</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
            <span class="pl-c1">type</span>: <span class="pl-s">'separator'</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-kos">;</span>

    <span class="pl-kos">(</span><span class="pl-k">new</span> <span class="pl-s1">electron</span><span class="pl-kos">.</span><span class="pl-c1">BrowserWindow</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
        <span class="pl-kos">.</span><span class="pl-en">loadURL</span><span class="pl-kos">(</span><span class="pl-s">`https://github.com`</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></pre></div>
<h4 dir="auto">OS X</h4>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/170270/15799559/fb6a624c-2a60-11e6-9600-de1338d02b1d.png"><img width="89" alt="screen shot 2016-06-04 at 14 29 49" src="https://cloud.githubusercontent.com/assets/170270/15799559/fb6a624c-2a60-11e6-9600-de1338d02b1d.png" style="max-width: 100%;"></a></p>
#### Windows
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/170270/15799560/02ffc1f0-2a61-11e6-98fe-ac1ea800a525.png"><img width="84" alt="screen shot 2016-06-04 at 14 29 22" src="https://cloud.githubusercontent.com/assets/170270/15799560/02ffc1f0-2a61-11e6-98fe-ac1ea800a525.png" style="max-width: 100%;"></a></p>
## 
<p dir="auto">This includes cases like this, which is annoying to have to handle manually:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[ { label: 'Unicorn' },
  { type: 'separator' },
  { label: 'Cut', role: '', visible: false },
  { label: 'Copy', role: '', visible: false },
  { label: 'Paste', role: '', visible: false } ]"><pre class="notranslate"><span class="pl-kos">[</span> <span class="pl-kos">{</span> <span class="pl-c1">label</span>: <span class="pl-s">'Unicorn'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">'separator'</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">'Cut'</span><span class="pl-kos">,</span> <span class="pl-c1">role</span>: <span class="pl-s">''</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-c1">label</span>: <span class="pl-s">'Copy'</span><span class="pl-kos">,</span> <span class="pl-c1">role</span>: <span class="pl-s">''</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-c1">label</span>: <span class="pl-s">'Paste'</span><span class="pl-kos">,</span> <span class="pl-c1">role</span>: <span class="pl-s">''</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></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/170270/15799784/3d0387ae-2a68-11e6-875a-f0502e88b5ed.png"><img width="109" alt="screen shot 2016-06-04 at 15 22 54" src="https://cloud.githubusercontent.com/assets/170270/15799784/3d0387ae-2a68-11e6-875a-f0502e88b5ed.png" style="max-width: 100%;"></a></p>
## 
- Electron version: 1.2.1
- Operating system: OS X 10.11.5