Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR-Code not displayed in Google Chrome when center image is defined #64

Open
j-ruch opened this issue Sep 25, 2022 · 5 comments
Open

QR-Code not displayed in Google Chrome when center image is defined #64

j-ruch opened this issue Sep 25, 2022 · 5 comments

Comments

@j-ruch
Copy link

j-ruch commented Sep 25, 2022

Description:

We are using the ng-qrcode library ^7.0.0 in our Angular project to display qr-codes for a specific URL. This issues was found using the Google Chrome browser. We tested different browsers on our end. You can see the browsers and versions below. The only Browser that had such problems was Google Chrome. All other browsers were working as expected with a center image in the qr-code.

Issue Reproduction:

When we first fetch the data and create a qr-code url the qr-code is properly displayed in our UI.

image

When we send a second request, fetch new data and re-create the qr-code url, the qr-code is not displayed anymore.

image

A workaround for this issue was to simply remove the center image from the code and everything was running fine again in Google Chrome. We assume there might be an issue within the library.

<!--<qr-code [value]="qrCodeUrl" centerImageSrc="assets/img/logo-small-white-background.svg"></qr-code>-->
<qr-code [value]="qrCodeUrl"></qr-code>

Versions:

We tested this issue in

  • Google Chrome (v. 105.0.5195.127)
  • Firefox (v. 105.0.1)
  • Opera GX (v. 90.0.4480.117)
  • MS Edge (v. 105.0.1343.50).
  • ng-qrcode (v. ^7.0.0)
mnahkies added a commit that referenced this issue Dec 3, 2022
previously if the image was already loaded, changing the value of the QR
code would make it disappear.

this change fixes that by immediately drawing the image if the complete
property is true

may help with #64 - although as reported that was essentially the
reverse of this situation :/

ref:
- https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/complete
@mnahkies
Copy link
Owner

mnahkies commented Dec 3, 2022

I attempted to reproduce this today, but only succeeded in reproducing a similar but different issue where the QR Code still rendered correctly but the center image disappeared.

I've put a fix up (#71) for that which will be released in v8.0.1

If you could provide a stackblitz or similar that reproduces the issue for you I'd be happy to investigate further

mnahkies added a commit that referenced this issue Dec 3, 2022
* fix: re-draw already loaded center images on change

previously if the image was already loaded, changing the value of the QR
code would make it disappear.

this change fixes that by immediately drawing the image if the complete
property is true

may help with #64 - although as reported that was essentially the
reverse of this situation :/

ref:
- https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/complete

* chore: update version/changelog
@rala72
Copy link

rala72 commented Feb 14, 2023

I'm facing this issue today as well, but only on Android.
Windows Chrome Version 110.0.5481.97 is fine; Android 110.0.5481.65 not.

@mnahkies
Copy link
Owner

@rala72 which version of ng-qrcode are you using?

Could you provide a https://stackblitz.com/ that reproduces it for you?

@rala72
Copy link

rala72 commented Feb 15, 2023

I'm sorry, I got confused with the qr code libraries and it looks like I'm using angularx-qrcode.
Sorry again for the noise.

@konstantinosftw
Copy link

I observe the same problem only on a specific android phone, Samsung A33, which is a 2022 phone. All other androids and iPhones, some quite older, show the centerImageSrc image normally.

I am not sure how to create a stackblitz with me exact app settings, I simply copy pasted the boilerplate code from here and changed the value and the centerImageSrc values.

What happens is that when I navigate to the QR page, the QR shows for a split second, then the centerImage appears and the QR disappears behind it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants