Just when testing the FTP and other server connectivity, I came across a quirky issue:
When I double click the password field, it automatically select all, and I copy it, sounds nice.
It didn’t work and FileZilla told me that there’s spaces in the password.
I pasted my password to an editor and indeed saw that there’s spaces before and after the password. Selecting other fields by double clicking works perfectly.
I don’t know what this exactly is and I didn’t actually see in code why would this happen. I do have a sense that this might be why did some people claimed to have copy pasted the password but it end up not working.
This only happens in FireFox and not Chromium by the way. I use FireFox 129 and Chromium 128 as of speaking.
Just to note if I click it only once then it copies correctly
if a double click is made then it adds
Maybe it can be temporarily added if the “show” button is clicked to automatically copy to the clipboard and inform the user that the password has been copied to the CB.
For some unknown reason, if you use a <code> tag, Firefox adds a space to the start of the string. A fix is being deployed now that solves it by just not using a code tag for this.
I never really thought about it, but a copy to clipboard button would probably be more useful to have. I’ll have to put some effort into making that work in a generic way though, it would be good to have for other data too, like usernames and server hostnames.
It covers all browsers, there are no problems with permissions (R/W in CB), it copies so that it keeps the formatting, and not that each browser chooses how to format (but in your case, it doesn’t matter because you need plain text).
I was planning to go with plain old navigator.clipboard.writeText and not use any library. But that ClipboardJS library seems useful if it turns out that clipboard management is more difficult than that.