Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Attribution section is including the copy button text #1437

Closed
1 task
fcoveram opened this issue May 13, 2022 · 13 comments
Closed
1 task

Attribution section is including the copy button text #1437

fcoveram opened this issue May 13, 2022 · 13 comments
Assignees
Labels
💻 aspect: code Concerns the software code in the repository bug Something isn't working 🛠 goal: fix Bug fix good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🟨 tech: javascript Requires familiarity with JavaScript

Comments

@fcoveram
Copy link

fcoveram commented May 13, 2022

Description

Copying the text from Credit the creator section using the button includes the text of the button itself in the Chrome browser.

Reproduction

  1. Visit this or any image.
  2. Click the "copy" button for "Credit the creator" HTML tab.
  3. Paste the content into a text editor and notice the "Copy text" added at the end

Environment

  • Browser: Chrome 101.0.4951.64

Additional context

Issue #1425 might be related.

Resolution

  • 🙋 I would be interested in resolving this bug.
@fcoveram fcoveram added 🟩 priority: low Low priority and doesn't need to be rushed 🛠 goal: fix Bug fix labels May 13, 2022
@AetherUnbound
Copy link
Contributor

Here's a video:

Screencast.2022-05-13.10.08.51.mp4

Note that on Pastebin it looks like the newline gets displayed as a proceeding space.

@sarayourfriend
Copy link
Contributor

It's strange. I remembering being able to reproduce this but I can't any more. I only see the preceding space, no matter where I paste it (tried vim, pastebin, vscode, I tried just echoing it into my terminal).

It is weird that the preceding space is there though. I wonder if it just needs a .trim() call on the string?

@fcoveram
Copy link
Author

I can not watch or even download the video file.

@AetherUnbound
Copy link
Contributor

It seems like Firefox does not like the video encoding - I am able to watch the video in Chrome though.

@fcoveram
Copy link
Author

You are right. Now I can see it, and I thought it was a randomly-text line.

@sarayourfriend
Copy link
Contributor

@AetherUnbound can you copy the character that's added on the first line? When I analyze what gets put into my clipboard, it's just a regular space character. I'm wondering if for you it's somehow something other than that.

Is anyone else able to reproduce this? @WordPress/openverse-maintainers

@AetherUnbound
Copy link
Contributor

You know....I think this might just be gvim's pasting behavior 😂 😭 🤦🏼‍♀️ I do remember seeing several newlines when I originally filed this, but that must have been fixed with the most recent frontend deployment. I think there's only the space at the beginning now, not any actual newlines. Should we leave this open to correct that? Or is that a non-issue?

@krysal
Copy link
Member

krysal commented May 17, 2022

I was able to reproduce this during the bug bash in Venice. I tried again and is kind of funny because I don't see new lines anymore but in Firefox it shows a space at the very beginning to me, and in Chrome it adds the text of the button after two new lines.

Copying HTML from Chrome

<p class="attribution">"<a target="_blank" rel="noopener noreferrer" href="https://www.flickr.com/photos/10511163@N00/520385031">Top Overview</a>" by <a target="_blank" rel="noopener noreferrer" href="https://www.flickr.com/photos/10511163@N00">Katharine Berry</a> is licensed under <a target="_blank" rel="noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=openverse">CC BY-NC-SA 2.0 <img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" style="height: 1em; margin-right: 0.125em; display: inline;"></img><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg" style="height: 1em; margin-right: 0.125em; display: inline;"></img><img src="https://mirrors.creativecommons.org/presskit/icons/nc.svg" style="height: 1em; margin-right: 0.125em; display: inline;"></img><img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" style="height: 1em; margin-right: 0.125em; display: inline;"></img></a>. </p>


Copy text

Copying Plain text from Chrome

"Top Overview" by Katharine Berry is licensed under CC BY-NC-SA 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=openverse.

Copy text

Note that this occurs in both production and staging.

@sarayourfriend sarayourfriend changed the title Wrong content copied from the attribution box Trim leading/trailing whitespace from attribution copy button May 18, 2022
@sarayourfriend sarayourfriend changed the title Trim leading/trailing whitespace from attribution copy button Trim leading/trailing whitespace from attribution copy button result May 18, 2022
@sarayourfriend sarayourfriend added 💻 aspect: code Concerns the software code in the repository 🟨 tech: javascript Requires familiarity with JavaScript good first issue New-contributor friendly help wanted Open to participation from the community labels May 18, 2022
@sarayourfriend
Copy link
Contributor

I've update the issue to trim the whitespace. I'd say this is very low priority. It might be trivial to fix but I could also see it being a ball of worms somehow.

The double space I'm not sure what to do about. How much do we care about that kind of thing?

@carlosreyesmunoz
Copy link
Contributor

carlosreyesmunoz commented May 19, 2022

I am having a look to this issue.
I didn't manage to reproduce it by copying the content on a vsCode note, but with the text I also get the button text "copy text"

`
"Top Overview" by Katharine Berry is licensed under CC BY-NC-SA 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=openverse.

Copy text
`
just like that.

I would be interested on having a look at this

@sarayourfriend
Copy link
Contributor

@carlosreyesmunoz That looks like the same result @krysal got too. Very strange!

I've assigned the issue to you 🙂 Feel free to ping if you need and assistance.

@krysal krysal changed the title Trim leading/trailing whitespace from attribution copy button result Attribution section is including the copy button text May 19, 2022
@krysal krysal added the bug Something isn't working label May 19, 2022
@krysal
Copy link
Member

krysal commented May 19, 2022

Fixed in #1458.

@krysal
Copy link
Member

krysal commented May 19, 2022

I created basically a duplicate of this issue in WordPress/openverse#553 to specifically address the leading/trailing spaces and updated this one to reflect the problem with the button text included that @carlosreyesmunoz already fixed.

Thanks, Carlos! ✨

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository bug Something isn't working 🛠 goal: fix Bug fix good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🟨 tech: javascript Requires familiarity with JavaScript
Projects
None yet
Development

No branches or pull requests

5 participants