UX of copying to clipboard the link to a post


(Dan Dascalescu) #1

Story: desktop user wants to share a link to a post via a channel of their choice.

Right clicking the “link” icon doesn’t work, because the element is a button. The user has to left click the “link” icon, then right click the link in the popup and copy it to clipboard, then close the popup. Slightly cumbersome.

On the other hand, clicking the “link” button does reveal extra actions, so conceptually it should be a button and not an anchor element.

Just putting this UX issue up there for potential discussion.


(Jeff Atwood) #2

Possibly, but right clicking the date at the upper right of the post might work, I haven’t checked this in a while. And of course copying the address bar in your browser works as it reflects current position in topic.


(Dan Dascalescu) #3

The timestamp indeed links to the correct post.

On this very thread, the address bar doesn’t add the /2 to your post because there isn’t sufficient vertical space to scroll down past it and trigger the scroll spy. (Edited out a block of text that artificially increased the “height” of my post).


(Jeff Atwood) #4

Yes, right click the timestamp.

I am not sure right clicking a “button” is an expected activity, personally.


(Dan Dascalescu) #5

Agree, if the button looks like one. The icon looks like… a link :slight_smile:


(Dean Taylor) #6

Just an FYI, the state of “copy to clipboard” has changed - this “might” be useful to improve this feature.

There has recently been support added for execCommand('copy') to Chrome 43+ and upcoming support for Firefox 41 - couple that with existing IE10+ and Opera 29+ that actually seems like “good” browser coverage is coming.

I’ve added a StackOverflow answer to reflect this here with additional reference links and an example:


(Erlend Sogge Heggen) #7

There’s a new library in town aptly called clipboard.js that seems to be achieving widespread adoption. cc @riking

The demo let me copy text successfully, which is a good sign since I was also experiencing a false “copied to clipboard” message with the first iteration of this feature (Mac OS X 10.10 and Chrome).


(Jeff Atwood) #8

Not sure if there is still interest in this; perhaps HTML clipboard standards have evolved since 2015?


(Erlend Sogge Heggen) #9

Probably plugin territory. clipboard.js is still alive and well so that’s good.

Alternatively those interested in this feature could add Discourse to the clipboard browser extension (primarily for code blocks but they might accept other additions too):


(Joshua Rosenfeld) #10

This theme worked for me in Chrome and Firefox. If the code can be confirmed in our other supported browsers, it may be able to be used outside of codeboxes: