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: Add copy button in input fields #37

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

pateldivyesh1323
Copy link
Contributor

Description

Add copy button on hover in text area

Fixes #24

Video

CEL.Playground.-.Google.Chrome.2023-10-26.17-39-08.mp4

Checklist

  • I have labeled this PR with the relevant Type labels
  • I have documented my code (if applicable)
  • My changes are covered by tests

@joaovictor3g
Copy link
Contributor

joaovictor3g commented Oct 26, 2023

Hi @pateldivyesh1323 I was testing your changes and I got those errors.

cel

They happen because the Clipboard API only works in secure context as this article says, probably in production environment it will work properly. Even though, as a suggestion in not secure environments a fallback can be provided to make clear why the copy is not working.

@pateldivyesh1323
Copy link
Contributor Author

Hi @joaovictor3g can you tell me how to reproduce it or how you tested it, and more about fallback which you are suggesting.

@joaovictor3g
Copy link
Contributor

joaovictor3g commented Oct 26, 2023

Hi @pateldivyesh1323 i have tested in my local environment running make serve, i am using chrome but the error behavior happened in firefox too. Basically the Clipboard API does not work outside HTTPS certificate. And about the fallback a simple console.error must solve it.

@pateldivyesh1323
Copy link
Contributor Author

@joaovictor3g

   navigator.clipboard.writeText(value).catch(console.error);

like this?

yes it does not usually work on http, but I cant reproduce it although I am using chrome

@joaovictor3g
Copy link
Contributor

@pateldivyesh1323 yes, like that, can you please commit it?

@pateldivyesh1323
Copy link
Contributor Author

@joaovictor3g Done.

@joaovictor3g
Copy link
Contributor

@pateldivyesh1323 thank you very much for your contribution and collaboration.
We really appreciate it.

@joaovictor3g joaovictor3g merged commit 66f8b4e into undistro:main Oct 26, 2023
3 checks passed
@joaovictor3g joaovictor3g added the hacktoberfest-accepted Accept PR from hacktoberfest label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accept PR from hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy button for input fields
2 participants