OpenSearch-Dashboards: [BUG] Share > Copy link broken in Safari
Describe the bug
Share > Copy link is broken in Safari. When you try to copy a link, you hear a sound and see a popup which says Copied, but nothing is copied into the clipboard.
To Reproduce Steps to reproduce the behavior:
- Go to
Discover - Click on
Share>Copy link
Expected behavior
Copy link should work in Safari.
OpenSearch Version 1.3.2 2.0.0
Dashboards Version 1.3.2 2.0.0
Plugins Default from the corresponding official Docker images
Host/Environment (please complete the following information):
- OS: macOS Catalina 10.15.7
- Safari 15.5 (15613.2.7.1.9, 15613)
Additional context
In Google Chrome 102.0.5005.61 it works without issues.
In Firefox 101.0 it works without issues.
No logs in the Safari Developer Tools > Console, besides the two probably unrelated, which appear on page reload
[Error] Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy. (discover, line 352)
[Log] ^ A single error about an inline script not firing due to content security policy is expected! (bootstrap.js, line 43)
Related to #689.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 32 (11 by maintainers)
I’d recommend creating a pull request and then you can get guidance based on the changes you’re making.
Thanks for the question - it depends 😆
Generally speaking every change should have a test associated with it. Sometimes a unit test is more than enough.
Another way you could approach this issue is by building a test case that fails and then making a fix that has the test passing.
Yes Leanne. The change I was proposing would go into security-dashboards-plugin where they manipulate the URL of the shareable.
parentNodeandSelection.removeAllRanges()[ref] we deselect it.selectNode[ref], and then usingaddRange[ref] to select it.I will pick this up @davidlago, please assign me. I will focus on closing my in review items & then pick this up in between.
This is not an issue of OUI.
OuiCopyis correctly triggeringdocument.execCommand('copy')but securityDashboards interferes with it.span, throws the URL being shared into it, selects it, and triggers “copy”.copyevent to inject tenants into the URL being copied and it does this by attempting to change the text inside the invisiblespanusingelement.textContent.The problem is that Firefox, Chrome, and Safari, each react differently. If some text in a node is “selected”:
textContentdoes nothing; the original text remains in the node and it continues to be selected.textContentbut also the result will be selected.textContentbut after that, nothing will be selected.As a result, when the button to copy link is hit:
This issue should be raised on security plugin. The appropriate solution would be for securityDashboards to change their listener to:
When the listener is done, the copy would occur.