-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OperatorHub: Use browser-native support for lazy-loading images
Firefox, Chrome, and Edge all support native lazy-loading for images with `loading="lazy"`. Prefer that over `react-lazyload` as it performs better, removes a dependency, and avoids some problems we've seen with images when filtering the catalog. This does mean that Safari will not lazy-load images, but will gracefully degrade. Lazy-loading is just an optimization. The worst performance problems around image loading have been fixed upstream in the OLM package server. In my testing, performance without lazy-loading is not bad. Firefox ESR 78 soon to be released will also support native lazy-loading.
- Loading branch information
Showing
4 changed files
with
9 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import 'react'; | ||
|
||
// Support the new `loading` attribute on images | ||
declare module 'react' { | ||
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> { | ||
loading?: 'lazy' | 'eager' | 'auto'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters