fix(electron): cmd+num not working on mac (#7865)

fix AF-1248
hidden menu group + acceleratorWorksWhenHidden does not work on mac
This commit is contained in:
pengx17 2024-08-14 04:14:16 +00:00
parent 05247bb24e
commit d5edadabe6
No known key found for this signature in database
GPG Key ID: 23F23D9E8B3971ED
2 changed files with 16 additions and 17 deletions

View File

@ -139,22 +139,19 @@ export function createApplicationMenu() {
undoCloseTab().catch(console.error);
},
},
{
label: 'Switch to tab',
acceleratorWorksWhenHidden: true,
visible: false,
submenu: [1, 2, 3, 4, 5, 6, 7, 8, 9].map(n => {
const shortcut = `CommandOrControl+${n}`;
const listener = () => {
switchTab(n);
};
return {
label: `Switch to tab ${n}`,
accelerator: shortcut,
click: listener,
};
}),
},
...[1, 2, 3, 4, 5, 6, 7, 8, 9].map(n => {
const shortcut = `CommandOrControl+${n}`;
const listener = () => {
switchTab(n);
};
return {
acceleratorWorksWhenHidden: true,
label: `Switch to tab ${n}`,
accelerator: shortcut,
click: listener,
visible: false,
};
}),
],
},
{

View File

@ -154,7 +154,9 @@ async function enableSplitView(page: Page) {
})
);
});
await page.reload();
await page.reload({
timeout: 30000,
});
}
test('open new tab via cmd+click page link', async ({ page }) => {