bytedance / bytedance/TableVerse

Do not report BibTeX copied when clipboard writing fails

Open Beginner friendly
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
25
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Problem

The BibTeX copy button reports success even when the clipboard write fails in the current Pages source (`web@66efcf4f1f8a4aaf5cc937e5b6d5bd9724f3ea04`).

The Clipboard API path calls the same success callback for both resolution and rejection:

```js
navigator.clipboard.writeText(text).then(done).catch(done);
```

The legacy fallback also ignores the boolean result of `document.execCommand('copy')` and calls `done()` unconditionally.

## Reproduction

1. Open https://bytedance.github.io/TableVerse/#bibtex in a browser context where clipboard writes are denied by permission or policy.
2. Click **Copy**.
3. Observe that the button changes to **Copied!** although the clipboard was not updated.

The rejection path can also be reproduced deterministically by replacing `navigator.clipboard.writeText` with a Promise that rejects before clicking the button.

## Expected behavior

The button should show success only after a confirmed clipboard write. If the modern API fails, the page may attempt the existing fallback, but a failed fallback should expose a clear error state.

## Actual behavior

Both success and failure paths display **Copied!**.

## Impact

Users may paste stale or unrelated clipboard content after receiving a false success message.

## Environment

- Source: `web@66efcf4f1f8a4aaf5cc937e5b6d5bd9724f3ea04`
- Live Pages deployment: https://bytedance.github.io/TableVerse/
- Affects browsers or embedded contexts that reject clipboard access

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the Pages source at the BibTeX Copy button entry point and inspect both the Clipboard API promise handling and the legacy document.execCommand('copy') fallback. Reproduce the rejected write described in the issue, then verify that only confirmed writes show “Copied!” and failed attempts expose an error state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.