-
Notifications
You must be signed in to change notification settings - Fork 907
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
[Bug] fix copy as curl #1472
[Bug] fix copy as curl #1472
Conversation
Copy as curl doesn't work in Dev Tools console due to usage of a deprecated method: https://developer.mozilla.org/en-US/docs/Web/API/Document/queryCommandSupported#browser_compatibility Issue Resolved: opensearch-project#1471 Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this found during smoke testing 2.0? Can we write tests for this?
async copyText(text: string) { | ||
if (window.navigator?.clipboard) { | ||
await window.navigator.clipboard.writeText(text); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will removing old logic drop support in old version, would be great to add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to caniuse, clipboard
is supported by the browsers updated at least in the passed 3 years. Barring IE, all those that supported execCommand
do support clipboard
.
Writing a test for this doesn't seem to be feasible since the tests need read and write permissions that they do not have to be able to access clipboard values in headless mode, which is the primary case that the tests run in. The DOM doesn't have the values required. This is shown by this error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think taking a backlog item for looking into a good way of testing this type of functionality is the right move
Signed-off-by: Bishoy Boktor <boktorbb@amazon.com>
* [Bug] fix copy as curl Copy as curl doesn't work in Dev Tools console due to usage of a deprecated method: https://developer.mozilla.org/en-US/docs/Web/API/Document/queryCommandSupported#browser_compatibility Issue Resolved: #1471 Signed-off-by: Kawika Avilla <kavilla414@gmail.com> * Adds browser compatibility comment Signed-off-by: Bishoy Boktor <boktorbb@amazon.com> Co-authored-by: Bishoy Boktor <boktorbb@amazon.com> (cherry picked from commit 376ba8c)
* [Bug] fix copy as curl Copy as curl doesn't work in Dev Tools console due to usage of a deprecated method: https://developer.mozilla.org/en-US/docs/Web/API/Document/queryCommandSupported#browser_compatibility Issue Resolved: #1471 Signed-off-by: Kawika Avilla <kavilla414@gmail.com> * Adds browser compatibility comment Signed-off-by: Bishoy Boktor <boktorbb@amazon.com> Co-authored-by: Bishoy Boktor <boktorbb@amazon.com> (cherry picked from commit 376ba8c) Co-authored-by: Kawika Avilla <kavilla414@gmail.com>
Description
Copy as curl doesn't work in Dev Tools console due to usage of a
deprecated method:
https://developer.mozilla.org/en-US/docs/Web/API/Document/queryCommandSupported#browser_compatibility
Signed-off-by: Kawika Avilla kavilla414@gmail.com
Issues Resolved
#1471
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr