fix: windowmenu did not show the window list on macOS (#16387)
This commit is contained in:
parent
df62e78b71
commit
52e257668d
3 changed files with 4 additions and 6 deletions
|
@ -231,7 +231,9 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
|||
[item setSubmenu:submenu];
|
||||
|
||||
// Set submenu's role.
|
||||
if (role == base::ASCIIToUTF16("window") && [submenu numberOfItems])
|
||||
if ((role == base::ASCIIToUTF16("window") ||
|
||||
role == base::ASCIIToUTF16("windowmenu")) &&
|
||||
[submenu numberOfItems])
|
||||
[NSApp setWindowsMenu:submenu];
|
||||
else if (role == base::ASCIIToUTF16("help"))
|
||||
[NSApp setHelpMenu:submenu];
|
||||
|
|
|
@ -247,9 +247,7 @@ const roles = {
|
|||
{ role: 'zoom' },
|
||||
...(isMac ? [
|
||||
{ type: 'separator' },
|
||||
{ role: 'front' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'window' }
|
||||
{ role: 'front' }
|
||||
] : [
|
||||
{ role: 'close' }
|
||||
])
|
||||
|
|
|
@ -442,8 +442,6 @@ describe('MenuItems', () => {
|
|||
if (process.platform === 'darwin') {
|
||||
expect(item.submenu.items[2].type).to.equal('separator')
|
||||
expect(item.submenu.items[3].role).to.equal('front')
|
||||
expect(item.submenu.items[4].type).to.equal('separator')
|
||||
expect(item.submenu.items[5].role).to.equal('window')
|
||||
} else {
|
||||
expect(item.submenu.items[2].role).to.equal('close')
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue