Alt text for images in posts

Aperta
#124 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start with createPostSchema in packages/shared/src/index.ts, then the Post model in apps/api/src/models/Post.ts, and the image in apps/web/src/components/PostCard.tsx near line 135 where the img alt is set. Add the optional trimmed imageAlt field to the schema and model, return it from the API, and add it to the composer in Composer.tsx. Done when schema tests cover too-long and empty input, the API response includes the field, and the card falls back to the current alt text when it is missing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

accessibility api enhancement help wanted web

Difficulty: Intermediate · Estimated size: 1 day

Context

Post images get a generic alt text (Image posted by @name), so people who use screen readers cannot tell what the picture shows.

Problem or goal

Let authors describe their image when they post it.

Suggested approach

  • Shared: add an optional imageAlt (max 300 characters) to the create-post schema and PostDTO.
  • API: store it on Post and return it. It is not editable if the image is not editable.
  • Web: an "Add description" field under the image preview in the composer, with a counter. Use it as the alt text in PostCard and fall back to the current text.

Where to look

  • apps/web/src/components/Composer.tsx
  • apps/web/src/components/PostCard.tsx (the <img alt> near line 135)
  • packages/shared/src/index.ts (createPostSchema)
  • apps/api/src/models/Post.ts

Acceptance criteria

  • A description is optional and trimmed.
  • The alt text is escaped by React like any other text.
  • Existing posts keep working.
  • Tests cover the schema (too long, empty) and the API response.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Lingua principale
TypeScript
Stelle
6
Fork
6
Merge medio
1h 59m
PR unite (30g)
59

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Haseeb-MernStack/commune

Tutte le issue di Haseeb-MernStack/commune

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.