Skip to content

Clipboard copy actions fail when Plannotator runs in insecure browser contexts #1173

Description

@quanweiZhou

What happened?

Problem

Several Plannotator UI copy actions call navigator.clipboard.writeText(...) directly. This breaks when the app is opened in an insecure browser context, such as a non-localhost HTTP URL, remote/devcontainer session, or an environment where the Clipboard API is unavailable or rejects writes.

In those cases, copy buttons either silently fail or show a generic failure even though the browser could still support the legacy document.execCommand('copy') path.

The error message in brower console:

(index):4521 Failed to copy: TypeError: Cannot read properties of undefined (reading 'writeText')
    at Ce ((index):4521:1930)
    at $T ((index):61:128930)
    at (index):61:134261
    at On ((index):61:15163)
    at Xk ((index):61:130183)
    at u0 ((index):62:28961)
    at pee ((index):62:28782)

Expected behavior

Copy buttons should work consistently in supported browsers, including when navigator.clipboard.writeText is unavailable or rejects due to browser security restrictions.

If all copy strategies fail, the UI should report the failure without crashing.

Plannotator version

plannotator 0.25.1

OS

Linux

Agent

Other

Where did it happen?

Annotate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions