Skip to content

clipboard.js: only show success checkmark after copy Promise resolves#708

Merged
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:684-clipboard-then
Jul 13, 2026
Merged

clipboard.js: only show success checkmark after copy Promise resolves#708
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:684-clipboard-then

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Fixes #684

The success checkmark () was appended to the DOM synchronously after calling navigator.clipboard.writeText(), before the async Promise resolved. If the copy failed, the user would see both the error alert AND the green checkmark simultaneously.

Moved the checkmark creation into a .then() callback so it only appears when the copy actually succeeds. If the Promise rejects, only the .catch() alert is shown.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

@yegor256 yegor256 merged commit d7ba2b6 into zerocracy:master Jul 13, 2026
16 checks passed
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.

clipboard.js shows success checkmark even when copy operation fails

2 participants