Skip to content

[Bug]: Preview browser silently denies clipboard writes #3738

Description

@nsxdavid

What happened?

Copy-to-clipboard buttons in apps opened in the desktop preview browser always fail. The same pages work in Chrome, which shows a clipboard permission prompt and remembers the grant. The preview browser never prompts and the write is denied.

Failure shape depends on the page protocol:

  • http pages: navigator.clipboard is undefined (normal browser secure-context rule, not a t3 bug)
  • https pages (secure context, so navigator.clipboard exists): writeText() rejects with NotAllowedError

Root cause

apps/desktop/src/preview/BrowserSession.ts registers a permission request handler whose allowlist contains "clipboard-write":

const allowed = ["clipboard-read", "clipboard-write", "notifications", "geolocation"];

But the permission Chromium actually requests for navigator.clipboard.writeText() is "clipboard-sanitized-write", so the grant never matches, and Electron denies without any prompt. The session also installs no setPermissionCheckHandler, which Electron consults synchronously for clipboard APIs.

Environment

  • Windows 11, desktop app 0.0.28, reproduced in a local source build
  • Preview page served over HTTPS (secure context) to rule out the secure-context failure mode

Fix

One-line allowlist addition plus a check handler. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions