Skip to content

Add fallback alt text, retry, and lazy loading to figma ImageWithFallback #183

Description

@Jagadeeshftw

📌 Description

ImageWithFallback (src/app/components/figma/ImageWithFallback.tsx) renders an inline base64 broken-image SVG on error with a generic alt, no default alt when alt is undefined, no retry, no onLoad signal, and no lazy loading.

💡 Why it matters: Images without alt text and without lazy loading hurt accessibility and performance.

🧩 Requirements and context

  • Provide a sensible default alt and an aria-label on the fallback.
  • Add loading="lazy" (where appropriate) and an onLoad callback.
  • Add an optional one-time retry before showing the fallback.
  • Extract the base64 SVG into a named constant.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b feat/imagewithfallback

2. Implement changes

  • Write/modify the relevant source: src/app/components/figma/ImageWithFallback.tsx
  • Write comprehensive tests: src/app/components/figma/ImageWithFallback.test.tsx
  • Add documentation: TSDoc
  • Include TSDoc doc comments
  • Validate security assumptions: do not echo untrusted src into visible text

3. Test and commit

  • Run tests:
npm run test
  • Cover edge cases: load error, missing alt, retry then success
  • Include test output and security notes in the PR description.

Example commit message

feat(image): alt fallback, retry, and lazy loading

✅ Acceptance criteria

  • Default alt + fallback aria-label
  • Lazy loading + onLoad support
  • Optional retry before fallback
  • Tests cover error/retry/missing-alt

🔒 Security notes

Avoid rendering untrusted src as user-visible text.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial CampaignGrantFox official campaign issueaccessibilityfrontendFrontend / UI workperformancePerformance / gas / resource use

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions