Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Improve the demo copy experience #19112

Closed
theswerd opened this issue Jan 7, 2020 · 15 comments · Fixed by #19291
Closed

[docs] Improve the demo copy experience #19112

theswerd opened this issue Jan 7, 2020 · 15 comments · Fixed by #19291
Labels
docs Improvements or additions to the documentation priority: important This change can make a difference ready to take Help wanted. Guidance available. There is a high chance the change will be accepted

Comments

@theswerd
Copy link
Contributor

theswerd commented Jan 7, 2020

Summary 💡

When I click to copy code or links to code I want a snackbar to pop up to let me know the text has been copied.

Examples 🌈

Example Usage

When I press copy I want a to see a snackbar to let me know text has been copied.

Motivation 🔦

It annoys me when I can't tell if I have successfully copied or not.

This would solve that problem.

@mbrookes mbrookes added the docs Improvements or additions to the documentation label Jan 7, 2020
@mbrookes
Copy link
Member

mbrookes commented Jan 7, 2020

Thanks for raising the issue. It's been a while, but I seem to recall that this was left out as a shortcut when the copy capability was first added, with the intention to add it later. That clearly never happened! 🙂

Would you like to work on it?

@theswerd
Copy link
Contributor Author

theswerd commented Jan 7, 2020

Definitely, I'll get right on it!

@oliviertassinari
Copy link
Member

I think that it's the type of cases where we could benefit from #18098.

@mbrookes I think that it would be interesting to look at the usage stats of the action on GA. Maybe we should move it to the main action bar, in which case the copied feedback might be better implemented with a tooltip.

@mbrookes
Copy link
Member

mbrookes commented Jan 7, 2020

"copy" accounts for 1.1% of demo events, compared to "expand" at 82.5%. (Being buried in the menu may partly account for that.) "GitHub" has a similar number of events despite being more visible, so there is some justification for swapping these.

Do you have an example of a tooltip being used for a notification? It feels to me like it breaks expectations. (Funnily enough, GA uses a snackbar for this.)

Capture d’écran 2020-01-11 à 17 08 53

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 7, 2020

  • 💯 for swapping the Copy (to the toolbar) and GitHub (to the menu) actions. The copy has the potential to be used way more frequently.
  • By tooltip, I have the following experience in mind (taken from Algolia):
    Jan-07-2020 17-05-58
    However, a snackbar could work too. I remember @eps1lon saying that changing a tooltip title might not be the best for a11y.

@mbrookes
Copy link
Member

mbrookes commented Jan 8, 2020

I believe it might be possible to make the title change accessible using an ARIA live region, but I'm not sure what screen readers read again if the live-region is on an element used for "aria-describedby" (i.e. does it also repeat the button information?).

Arguably when the tooltip title changes to "copied" it no longer describes the button, but as the user has already heard the original description at that point, so that shouldn't be a problem.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 8, 2020

Right, I think that we can ignore the a11y part of this from the equation. The copied feedback is a nice attention to the detail. So Tooltip or Snackbar, sounds both great.

@mbrookes
Copy link
Member

mbrookes commented Jan 8, 2020

@theswerd I'll let you cast the deciding vote with your PR 😄

@oliviertassinari oliviertassinari changed the title Add snackbars when text is copied [docs] Improve the demo copy experience Jan 11, 2020
@oliviertassinari oliviertassinari added ready to take Help wanted. Guidance available. There is a high chance the change will be accepted priority: important This change can make a difference labels Jan 11, 2020
@theswerd
Copy link
Contributor Author

@mbrookes Sorry for the wait, for some reason I thought I had already responded to this. I believe we should use a Snackbar because it will be more visible on mobile.

I just submitted a pr that will do it!

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 19, 2020

Thanks for resuming this effort :).

8% of the traffic is mobile on the documentation. We hide the demo actions, people can't copy on mobile, so we can completely ignore mobile for this concern.

Does it change the tradeoff?

@theswerd
Copy link
Contributor Author

Personally I prefer Snackbars over Tooltips, but @oliviertassinari's idea also seems good so I'll defer to you

@mbrookes
Copy link
Member

mbrookes commented Jan 19, 2020

Given no clear winner, I think there's an argument for using the Snackbar, as it the more "Material" way of doing it. Also, since you've already created the PR based on Snackbar...

@oliviertassinari
Copy link
Member

It sounds great 👍

@theswerd
Copy link
Contributor Author

theswerd commented Jan 19, 2020 via email

@mbrookes
Copy link
Member

@oliviertassinari The other benefit is that it supports a notification when copying links to the source (in the menu) that have no tooltip. @theswerd has already implemented this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation priority: important This change can make a difference ready to take Help wanted. Guidance available. There is a high chance the change will be accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants