Skip to content

Commit 118151a

Browse files
committed
docs: clean up wording on showCopySuccess
1 parent 91123d9 commit 118151a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

site/src/hooks/useClipboard.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ export type UseClipboardResult = Readonly<{
88

99
/**
1010
* Indicates whether the UI should show a successfully-copied status to the
11-
* user. This is _not_ the same as an `isCopied` property, because the hook
12-
* does not ever look at the clipboard, and only makes a guess at whether the
13-
* text has been copied.
11+
* user. When flipped to true, this will eventually flip to false, with no
12+
* action from the user.
1413
*
15-
* It is possible for this value to be true, yet for the clipboard not to
16-
* have the user's text in it. Trying to make this property accurate enough
17-
* that it could safely be called `isCopied` led to browser compatibility
18-
* issues in Safari
14+
* ---
15+
*
16+
* This is _not_ the same as an `isCopied` property, because the hook never
17+
* actually checks the clipboard to determine any state, so it is possible for
18+
* there to be misleading state combos like:
19+
* - User accidentally copies new text before showCopiedSuccess naturally
20+
* flips to false
21+
*
22+
* Trying to make this property accurate enough that it could safely be called
23+
* `isCopied` led to browser compatibility issues in Safari.
1924
*
2025
* @see {@link https://github.com/coder/coder/pull/11863}
2126
*/

0 commit comments

Comments
 (0)