openfoodfacts / open-prices-frontend

A vue.js front-end for Open Prices
22 stars 11 forks source link

highlight+copy barcode straight from OFF page to OP search box results in Product not found - transit via textfile works #574

Closed serpico closed 3 months ago

serpico commented 4 months ago

Epic: #

Description

  1. start at https://world.openfoodfacts.org/product/7622210796301/monaco-biscuits-crackers-a-l-emmental-belin
  2. highlight EAN after Barcode: ( located above quantity: 100g ) via double-click
  3. copy EAN via right-click and contextual menu
  4. paste EAN
  5. Product not found in Open Food Facts... Don't hesitate to add it :)

repeat steps 1 to 3 but paste into a text editor ( gedit in my case ), highlight and copy from there, product is found.

Same thing happen when you want to copy EAN from OFF page to add a new product

Looks like there's a space added in front of the EAN

raphodn commented 4 months ago

Where are you pasting the EAN ?

serpico commented 4 months ago

Sorry, in the OP search box see attachment

searchbox

raphodn commented 4 months ago

ok ! I'll be on holidays for the next few days. btw are you on the OFF Slack ? We have a #prices channel ;)

raphodn commented 3 months ago

On my laptop I can't seem to reproduce :thinking: Are you on mobile ?

raphodn commented 3 months ago

One solution would be to strip spaces when searching (remove any space at the start and at the end of the text)

serpico commented 3 months ago

On my laptop I can't seem to reproduce 🤔 Are you on mobile ?

I first noticed the problem when copying from a tab OFF's website on my laptop to the searchbox on OP's searchbox on the webapp on mobile ( using KDE connect's clipboard sharing feature). After this message I tried while staying on the laptop, copy from one tab with OFF's website to the next tab containing OP's webapp searchbox but the behavior was the same.

serpico commented 3 months ago

One solution would be to strip spaces when searching (remove any space at the start and at the end of the text)

If it's a quick fix to go that way ( a few lines of code ) I'd appreciate if we could give this a try and if it doesn't work we'll move on, either close the issue or keep it for reference but without plan to dig deeper until someone else report it.

raphodn commented 3 months ago

Could you try on a phone ? Or on another laptop ? Or send a video ?

I can't reproduce, so it could come from your OS.. ?

serpico commented 3 months ago

here's a video entirely on a mobile phone

https://transfert.free.fr/8gpgVe1

I'll try all on a windows laptop soon and report

PS: I tried to upload the file here on github but it was > 10MB, used ffmpeg to get it down to 2.5 then there was a message about mime type...

raphodn commented 3 months ago

Thanks a lot for the video !

So i did some tests, and dug inside the code

Could you try to test again in the staging environment ? https://prices.openfoodfacts.net/app/

serpico commented 3 months ago

Thank you to keep trying!!! ( I realize it's kinda trivial and related to my workflow :smile: )

All the following was done on desktop laptop.(edited)

It seems the problem comes from the "copying from OFF" part as : when I select and copy the EAN and see this ( a screenshot I took from OFF ) testnospace I'm thinking, ok only the selected/highlighted part is being copied (so there will be no space). However when I paste on a text editor the "problematic" space before the EAN is already there (as it would be if I pasted on the OP searchbox).

Is it the same behavior on your machine?

PS: I noticed a change, my screenshoter allows me to draw a zone to screenshot.

Before it was the same in both case, space or no space, there was no "disappearance" whether the draw mode was activated or not.

raphodn commented 3 months ago

With Brave + Ubuntu I can't reproduce the "copying the barcode from OFF comes with a space".

BUT with Firefox + Ubuntu I indeed have this problem :eyes:

I guess this is a Firefox issue...