Bug Bash: Fix Safari copy issue#489
Merged
robertjdominguez merged 2 commits intomainfrom Jul 16, 2024
Merged
Conversation
This PR resolves the issue with copying on Safari. Turns out, a Docusaurus dependency has an [unpatched bug](sindresorhus/copy-text-to-clipboard#47). This closes hasura/graphql-engine#10341 and closes hasura/graphql-engine#10349.
Collaborator
Author
|
Hey, @robertjdominguez 👋 Thanks for this PR! Since you changed docs files, our automated Action assigned Rob as your reviewer 🎉 Before Rob looks over the changes, we ask you to take care of a couple of items:
The docs team aims to get all PRs reviewed within 48 hours of your team doing a review in the form of a content pass. Let Rob know the level of urgency on Slack 👍 |
seanparkross
approved these changes
Jul 16, 2024
Deploying v3-docs with
|
| Latest commit: |
e43561a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e7ebb9f3.v3-docs-eny.pages.dev |
| Branch Preview URL: | https://rob-bug-bash-fix-safari-copy.v3-docs-eny.pages.dev |
|
FYI we are going to use the clipboard api starting Docusaurus v3.9 so you'll be able to remove the swizzled code: facebook/docusaurus#11422 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves the issue with copying on Safari. Turns out, a Docusaurus dependency has an unpatched bug. This closes hasura/graphql-engine#10341 and closes hasura/graphql-engine#10349.
DOCS-2205
Design
This PR swizzles the existing
<CopyButton />component of Docusuarus. Honestly, little code is changed, but we've swapped out the dependency on thecopy-text-to-clipboardpackage to instead use thenavigator.clipboardAPI, which enjoys support across all modern browsers. Why is Docusaurus using this dep? No clue.We have a utility function that will check to ensure the API is available and then copy the passed string:
Which is then used in the component via a callback:
☝️ Much of the original design here is borrowed from the ejected component via Docusaurus.
Testing