@vanzasetia
Posted
Hi, Dustin!
One suggestion I have is to add alternative text to the QR code. Like @MelvinAguilar said, it is not a decorative image. It is the main content of the site. So by adding alternative text, the screen readers can read the alternative text to announce to the users that there is a QR code.
Also, you can add width
and height
attributes to the image element. This way, browsers will know how much space the image requires before it is loaded. As a result, it will prevent the layout shift.
I hope this helps.
Marked as helpful
@MelvinAguilar
Posted
@dustinsoos @vanzasetia Hi! I read another article on the same website recently, and another positive point is that setting the width and height of the images is one way to use the loading="lazy"
attribute to ensure the images load in accordance with their position in relation to the viewport of the device, which means it prevents all images from loading, and only shows those occupying the screen at the moment.
Browser-level image lazy-loading for the web
Please correct me if I'm wrong :) happy coding!
@vanzasetia
Posted
@MelvinAguilar It is a nice article! Thank you for sharing, Melvin!