Skip to content

[Fix] Avatar shows full name instead of initials when image is unavailable - #36

Merged
brunobergher merged 3 commits into
developfrom
fix/avatar-initials-fallback-3vxcr65gs5mzo
Jul 9, 2026
Merged

[Fix] Avatar shows full name instead of initials when image is unavailable#36
brunobergher merged 3 commits into
developfrom
fix/avatar-initials-fallback-3vxcr65gs5mzo

Conversation

@roomote-roomote-v1

@roomote-roomote-v1 roomote-roomote-v1 Bot commented Jul 9, 2026

Copy link
Copy Markdown

Opened on behalf of Bruno Bergher. Follow up by mentioning @openmote, in the web UI, or in Slack.

What changed

When a profile image is missing, blank, or fails to load, the avatar circle shows initials only (for example LA) instead of painting the full display name.

The image uses an empty alt so browsers cannot use the name as broken-image replacement text. Failure is tracked per URL via both onError and a bind-time check for already-complete broken images (complete with naturalWidth === 0), so cached 404s / some SSR hydration paths still fall back to initials even if the error event never fires.

Why this change was made

Users were seeing full names inside the avatar control when no image was available, and a pure onError fallback could miss already-broken cached images.

Impact

Across web surfaces that use the shared Avatar primitive (user menu, task cards, settings, task info), missing or broken avatar images show initials only. The accessible name stays on the wrapper via aria-label.

Screenshots

Sidenav avatar shows LA initials only

Open user menu avatar shows LA initials; full name stays outside the circle

@roomote-roomote-v1

roomote-roomote-v1 Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

No code issues found. See task

  • apps/web/src/components/system/primitives/avatar.tsx:96 - The fallback only runs from the React onError handler. During SSR/hydration, an avatar URL that 404s before hydration or from cache can miss that event and remain a broken image instead of initials; add a mounted image-state check, such as a ref plus complete/naturalWidth, or equivalent handling. Resolved by the mounted image-state check in the current head.

@brunobergher
brunobergher marked this pull request as ready for review July 9, 2026 15:37
@brunobergher
brunobergher merged commit be98bd5 into develop Jul 9, 2026
@mrubens
mrubens deleted the fix/avatar-initials-fallback-3vxcr65gs5mzo branch July 12, 2026 04:19
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

Successfully merging this pull request may close these issues.

2 participants