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

loading attribute of component Image or Avatar doesn't work #7192

Closed
1 of 3 tasks
KKzLEO opened this issue Jan 4, 2023 · 3 comments
Closed
1 of 3 tasks

loading attribute of component Image or Avatar doesn't work #7192

KKzLEO opened this issue Jan 4, 2023 · 3 comments

Comments

@KKzLEO
Copy link

KKzLEO commented Jan 4, 2023

Description

I want to add loading attr for Avatar component to have lazy-loading function, but it doesn't work well because the loading attribute doesn't be passed to use-image hook so it still loaded each image in the first time instead of scrolling

at line 34 of avatar-image.tsx
image

Link to Reproduction

https://codesandbox.io/s/dark-wind-xc0t2m?file=/src/index.js

Steps to reproduce

  1. Open dev tool and go to Network tab
  2. Filter with image
  3. Go to sandbox
  4. Comment and uncomment Success or Failure example and see the differences (Remember refresh the whole page cuz cache)
  5. You can see the lazyloading function of original img tag works well but Image or Avatar doesn't.

Chakra UI Version

3.2.1

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@segunadebayo
Copy link
Member

For this case, please use the Img component and pass the loading attribute to it instead.

<Img loading="lazy" rounded="full" />

@KKzLEO
Copy link
Author

KKzLEO commented Jan 16, 2023

@segunadebayo it's still not working even using Img component instead.
image

@KKzLEO
Copy link
Author

KKzLEO commented Feb 3, 2023

@segunadebayo could you reopen this issue?

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

2 participants