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

fix(theme-classic): minor code copy button improvements #6986

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Mar 24, 2022

Motivation

  • Reduced the timeout to 1s which seems more sensible
  • Clean up the timeout before unmount because state is mutated in the timeout:

image

I also think that the button is only ever reset to the original state after the timeout, so even when the cursor leaves the code block, the button stays as a tick, which seems a little weird. But changing that requires moving state management up to CodeBlock which seems too much trouble.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

@Josh-Cena Josh-Cena added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Mar 24, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 24, 2022
@netlify
Copy link

netlify bot commented Mar 24, 2022

[V2]

Name Link
🔨 Latest commit 96457d3
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/623c8d1e20eee00008e35048
😎 Deploy Preview https://deploy-preview-6986--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Mar 24, 2022

[V2]

Name Link
🔨 Latest commit 96457d3
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/623c8d3a3a0bea00086c0198
😎 Deploy Preview https://deploy-preview-6986--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Josh-Cena
Copy link
Collaborator Author

Ugh, the GitHub actions never kicked 😄

image

@github-actions
Copy link

github-actions bot commented Mar 24, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 47
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6986--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Mar 24, 2022

Size Change: 0 B

Total Size: 806 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 49.9 kB
website/build/assets/css/styles.********.css 105 kB
website/build/assets/js/main.********.js 612 kB
website/build/index.html 38.8 kB

compressed-size-action

@slorber
Copy link
Collaborator

slorber commented Mar 24, 2022

👍

I also think that the button is only ever reset to the original state after the timeout, so even when the cursor leaves the code block, the button stays as a tick, which seems a little weird. But changing that requires moving state management up to CodeBlock which seems too much trouble.

Note that technically we already have CopyButton CSS targeting a parent (but stable global) CSS selector so we could do the same with JS and attach a mouseOut listener

Not sure it's worth it though so I'll merge this as is

@slorber slorber merged commit 21ff25e into main Mar 24, 2022
@slorber slorber deleted the jc/fix-copy-button branch March 24, 2022 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants