phac-nml / irida-next

IRIDA Next
https://phac-nml.github.io/irida-next/
Apache License 2.0
8 stars 2 forks source link

Fix: PAT Copy to clipboard on Firefox (DFCT0010063) #612

Closed ericenns closed 1 month ago

ericenns commented 1 month ago

What does this PR do and why?

Describe in detail what your merge request does and why.

This PR fixes the clipboard component so that it functions in browsers other than chrome when value is hidden.

Previously the copy to clipboard component used javascript to verify that the javascript is first allowed to write to the clipboard before attempting to write to the clipboard. This permission verification only works on Chrome, no other browsers respond to this. But since this is a user driven action we do not need to verify permission as it is automatically granted. The fallback behavior was to select the input and then initiate copy, but since the input stores *** when hidden we cannot use that as it only works after the user clicks the eye icon to show it on screen. Since all the other browsers support Clipboard.writeText() we can just call the method directly and remove the fallback behavior after removing browser permission verification.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Update asdf ruby plugin
    asdf plugin update ruby
  2. Ensure asdf dependencies updated
    asdf install
  3. Install gems
    bundle
  4. Migrate database
    bin/rails db:migrate
  5. Launch server
    bin/dev
  6. Launch firefox and generate a new personal access token, and click copy to clipboard. Paste into a blank document and ensure content is not ********************.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

github-actions[bot] commented 1 month ago

Simplecov Report

Covered Threshold
92.32% 90%