Skip to content

Conversation

Yanseses
Copy link

@Yanseses Yanseses requested a review from ogonkov as a code owner September 12, 2025 19:11
Copy link
Contributor

gravity-ui bot commented Sep 12, 2025

Preview is ready.

if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
try {
return navigator.clipboard.writeText(text);
navigator.clipboard.writeText(text);
Copy link
Contributor

Choose a reason for hiding this comment

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

How this solves the problem?

Copy link
Contributor

@amje amje Sep 12, 2025

Choose a reason for hiding this comment

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

writeText returns a Promise, so if it fails normally (security issue) we'll never get into the catch block and run fallback

Copy link
Contributor

@amje amje Sep 12, 2025

Choose a reason for hiding this comment

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

I guess this should we async/await function to work correctly indeed

Copy link
Contributor

gravity-ui bot commented Sep 12, 2025

Visual Tests Report is ready.

@amje amje linked an issue Sep 12, 2025 that may be closed by this pull request
2 tasks
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.

Fix copy to clipboard functionality on Colors and Typography demos
4 participants