Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63274

Copy to clipboard doesn't work for api tokens

    XMLWordPrintable

Details

    • jenkins-2.253

    Description

      http://localhost:8080/user/admin/configure

      the api token doesn't appear on my clipboard

      (don't worry about the token itself it's just a dummy local test instance.)

      Attachments

        Issue Links

          Activity

            timja Tim Jacomb added a comment -
            timja Tim Jacomb added a comment - fyi wfollonier

            timja Thank you for the report. I reproduced it locally, will see what I can do there.

            wfollonier Wadeck Follonier added a comment - timja Thank you for the report. I reproduced it locally, will see what I can do there.
            wfollonier Wadeck Follonier added a comment - - edited

            The copy feature was introduced in 2.173 by https://github.com/jenkinsci/jenkins/pull/3977. It was working at that time.
            Still working in 2.235.
            Not working in 2.245 2.239.

            will look further...

            Found it, it was broken since 2.238 ! at that version the copied value is empty (erasing the clipboard)

            Comparison: https://github.com/jenkinsci/jenkins/compare/jenkins-2.237...jenkins-2.238

            No obvious modifications of JavaScript, seems to be related to an issue with CSS. In 2.237 the textArea generated to copy from, had display:inline-block and an height, compared to the one in 2.238, display:block, height=0px;

            At this point, I think it's a regression after https://github.com/jenkinsci/jenkins/pull/4700 as it changed the html/body display/height.

            wfollonier Wadeck Follonier added a comment - - edited The copy feature was introduced in 2.173 by https://github.com/jenkinsci/jenkins/pull/3977 . It was working at that time. Still working in 2.235. Not working in 2.245 2.239. will look further... Found it, it was broken since 2.238 ! at that version the copied value is empty (erasing the clipboard) Comparison: https://github.com/jenkinsci/jenkins/compare/jenkins-2.237...jenkins-2.238 No obvious modifications of JavaScript, seems to be related to an issue with CSS. In 2.237 the textArea generated to copy from, had display:inline-block and an height, compared to the one in 2.238, display:block, height=0px; At this point, I think it's a regression after https://github.com/jenkinsci/jenkins/pull/4700 as it changed the html/body display/height.
            wfollonier Wadeck Follonier added a comment - - edited

            fqueiruga as I don't want to break what you did to solve the regression, I will let you find the "correct" way to solve this issue.

            If I change the display of body from flex to block, the copy is working fine.

            Another attempt was to just put:

            el.style.position= "absolute";
            

            in copyButton.js. But I did not dig further to see if it's breaking something else, at least the screen was not "shaking" when doing so.

            Unfortunately when the copyButton was added, not test coverage was put in place. (I have some doubts that it's possible in HtmlUnit)

            wfollonier Wadeck Follonier added a comment - - edited fqueiruga as I don't want to break what you did to solve the regression, I will let you find the "correct" way to solve this issue. If I change the display of body from flex to block, the copy is working fine. Another attempt was to just put: el.style.position= "absolute" ; in copyButton.js . But I did not dig further to see if it's breaking something else, at least the screen was not "shaking" when doing so. Unfortunately when the copyButton was added, not test coverage was put in place. (I have some doubts that it's possible in HtmlUnit)
            fqueiruga Félix Queiruga Balado added a comment - - edited

            Id's suggest setting an absolute position and send it offscreen, for example

            top: -99999px; left: -99999px

            Also, set the tabindex attribute to -1

             

            fqueiruga Félix Queiruga Balado added a comment - - edited Id's suggest setting an absolute position and send it offscreen, for example top: -99999px; left: -99999px Also, set the tabindex  attribute to -1  

            People

              wfollonier Wadeck Follonier
              timja Tim Jacomb
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: