New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Recent api not working on macOS #40611
Comments
Hello @create3000. Thanks for reporting this and helping to make Electron better! Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use. Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests. Now adding the
blocked/need-repro
|
I created a test project at https://github.com/create3000/electron-recent-documents-api that uses the example code from https://www.electronjs.org/docs/latest/tutorial/recent-documents#example. To start the program type I tested it also on Windows, but had no luck. I further found out that a recent file is added on macOS under Apple > Recent Objects, but not in the Application menu and not in the Dock menu. |
I also just ran into this bug. I checked against some other Electron versions and it appears to be broken in 27.0.0+ (including 28.0.0-beta.11). It works for me in Electron 26.6.2. I am on macOS 14.0 (Sonoma) with an M1 processor. |
i'm able to reproduce this on electron@29.0.0 but as noted, it works fine in the 26.x release. The menu bar's recents remain dimmed and inactive, showing no submenu. however, right clicking on the app icon does show the recent items there. i looked at the code, namely still, i find that somewhat unlikely given that right clicking on the dock icon does show recent documents, which i assume are populated from the
|
Also running this issue on electron@28. The recentDocuments are populated correctly in the dock, but the Application Menu "Open Recent" always remains disabled. |
This is also not working for me in electron 29.3 running macOS Sonoma 14.4.1, either in production or in debug mode. The "Open Recent" menu stays disabled while recent documents appear in the app's Dock menu. |
I'm seeing the same issue on v27+ and managed to narrow it down to a specific nightly version. Here's the compare between the two releases v27.0.0-nightly.20230718...v27.0.0-nightly.20230719 As for reproduction, on electron fiddle, add this snippet inside the 'app.whenReady' app.whenReady().then(() => {
const template = [
{
label: "asdasd",
"submenu":[
{
"label":"Open Recent",
"role":"recentdocuments",
"submenu":[
{
"label":"Clear Recent",
"role":"clearrecentdocuments"
}
]
}
]
}
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
createWindow() I see some changes in the electron_menu_controller.mm related to recentDocuments but this is as far as I've got. |
This might be fixed in v29, see #41978 |
Preflight Checklist
Electron Version
27.1.2
What operating system are you using?
macOS
Operating System Version
Sonoma
What arch are you using?
x64
Last Known Working Electron version
don't know
Expected Behavior
Recent files added with
app.addRecentDocument
should appear in recentDocuments menu item and in dock app icon menu.Actual Behavior
Although I use
app.addRecentDocument
there do not appear any files in recentDocuments menu item, neither in packaged version of app nor in development mode.Testcase Gist URL
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: