Skip to content

Desktop: open folders with the system dialog, so ~/Desktop opens (v0.21.0) - #53

Merged
ralyodio merged 2 commits into
mainfrom
fix/desktop-native-open-dialogs
Oct 23, 2026
Merged

ralyodio merged 2 commits into
mainfrom
fix/desktop-native-open-dialogs

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Open Folder on ~/Desktop did nothing in the desktop app, and the next click said the picker was already open.

Cause: the page uses showDirectoryPicker. In Electron, picking a folder Chromium treats as sensitive (~/Desktop, ~) emits file-system-access-restricted on the session and waits for the app to answer. readm3 never listened, so the promise never settled and every later picker failed with "File picker already active".

Fix:

  • desktop/main.cjs: new pick and save-as IPC handlers using dialog.showOpenDialog / showSaveDialog. Files are read with fs through the existing load() and written back only to paths in opened, the same path readm3 edit . takes. A file-system-access-restricted listener answers allow for readm3's own pages, so a page picker can never hang again.
  • desktop/preload.cjs: exposes pick and saveAs.
  • site/disk.ts: pickFolder, pickFiles and saveAs use the bridge when it has them. Browsers and older desktop builds keep the page pickers.
  • New Playwright test: with a fake bridge, Open Folder, Ctrl+S and Save As go through the bridge and never call the page pickers.

Tests: typecheck clean, 198/198 unit tests, 19/19 viewer specs.

🤖 Generated with Claude Code

ralyodio and others added 2 commits October 23, 2026 07:19
…opens (v0.21.0)

In Electron the page's showDirectoryPicker never returns for a folder Chromium
calls sensitive (~/Desktop, ~): Electron emits file-system-access-restricted
and waits for an answer nobody gave, so every later click failed with
"File picker already active". Open Folder, Open Files and Save As now use
Electron's native dialogs; main.cjs reads the files with fs and writes back
only paths it opened, the same path as `readm3 edit .`. A listener answers
the restricted event too, so a page picker can never hang again. Older
desktop builds and browsers keep the page pickers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 9aeaab1 into main Oct 23, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant