Skip to content

docs: Update clipboard handling for Safari compatibility in LLMButtons#2258

Merged
birosrichard merged 3 commits intomasterfrom
fix/safari-clipboard
Feb 17, 2026
Merged

docs: Update clipboard handling for Safari compatibility in LLMButtons#2258
birosrichard merged 3 commits intomasterfrom
fix/safari-clipboard

Conversation

@birosrichard
Copy link
Copy Markdown
Contributor

@birosrichard birosrichard commented Feb 17, 2026

https://wolfgangrittner.dev/how-to-use-clipboard-api-in-safari/


Note

Low Risk
Small, localized change to a UI clipboard action; main risk is browser support/behavior differences for ClipboardItem and async fetch failures.

Overview
Updates the LLMButtons “Copy for LLM” flow to write fetched Markdown to the clipboard via navigator.clipboard.write([new ClipboardItem(...)]) instead of writeText, avoiding Safari rejecting clipboard operations when the fetch is awaited before the write.

Adds an in-function debug console.log of the created ClipboardItem.

Written by Cursor Bugbot for commit 8ecd7a9. Configure here.

@github-actions github-actions Bot added this to the 134th sprint - Web team milestone Feb 17, 2026
@github-actions github-actions Bot added the t-web Issues with this label are in the ownership of the web team. label Feb 17, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment @cursor review or bugbot run to trigger another review on this PR


// Copy to clipboard
await navigator.clipboard.writeText(markdownContent);
console.log('markdownContent', markdownContent);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log left in production code

Low Severity

A console.log('markdownContent', markdownContent) statement was left in, likely from debugging the Safari clipboard fix. This will log to the browser console on every "Copy for LLM" click in production.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cursoragent please remove the console.log

Copy link
Copy Markdown

@cursor cursor Bot Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've successfully removed the debug console.log statement from the LLMButtons component. The change has been committed and pushed to the fix/safari-clipboard branch.

The console.log at line 180 that was logging the markdownContent ClipboardItem has been removed, so it will no longer output to the browser console in production.

Open in Cursor Open in Web

'text/plain': fetch(markdownUrl)
.then(async (response) => response.text())
.then((content) => new Blob([content], { type: 'text/plain' })),
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing HTTP response error check after fetch

Medium Severity

The previous code checked response.ok and threw on non-2xx status codes (e.g., 404 or 500). The new promise chain inside ClipboardItem calls response.text() without checking response.ok, so a failed fetch (like a 404) will silently copy the error page HTML to the clipboard and display "Copied" success feedback to the user.

Fix in Cursor Fix in Web

@apify-service-account
Copy link
Copy Markdown

Preview for this PR was built for commit 8ecd7a9 and is ready at https://pr-2258.preview.docs.apify.com!

cursoragent and others added 2 commits February 17, 2026 12:30
Co-authored-by: Richard Biroš <richardbiros@icloud.com>
@apify-service-account
Copy link
Copy Markdown

Preview for this PR was built for commit 3482433d and is ready at https://pr-2258.preview.docs.apify.com!

@apify-service-account
Copy link
Copy Markdown

Preview for this PR was built for commit 363186d6 and is ready at https://pr-2258.preview.docs.apify.com!

@birosrichard birosrichard changed the title fix: Update clipboard handling for Safari compatibility in LLMButtons docs: Update clipboard handling for Safari compatibility in LLMButtons Feb 17, 2026
@birosrichard birosrichard merged commit 982a456 into master Feb 17, 2026
14 checks passed
@birosrichard birosrichard deleted the fix/safari-clipboard branch February 17, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-web Issues with this label are in the ownership of the web team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants