fix(a11y): add missing alt attributes to context icons and feedback images#115772
Conversation
…mages Add alt prop to ContextIconProps as an optional override that falls back to the icon name. Pass a descriptive alt (e.g. 'browser: chrome') from getContextIcon which has the semantic type context. Mark decorative feedback onboarding/empty-state illustrations with alt="" so screen readers skip them appropriately.
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.58% |
|
@priscilawebdev this is in the same-ish area as #115701 so i tagged you and design-eng to followup and help @macuzi get this over the line. Looks like |
|
Since So maybe need to update the |
Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
| } | ||
| return <ContextIcon name={iconName} {...contextIconProps} />; | ||
| return ( | ||
| <ContextIcon name={iconName} alt={`${type}: ${iconName}`} {...contextIconProps} /> |
There was a problem hiding this comment.
Bug: The ContextIcon component receives an alt prop, but it's not declared in its props or used, so the accessibility text is silently ignored.
Severity: LOW
Suggested Fix
Update the ContextIcon component to accept and use the alt prop. Add alt to the ContextIconProps interface, destructure it in the component's function signature, and pass it to the underlying rendered element that requires the accessibility text.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/components/events/contexts/utils.tsx#L367
Potential issue: The `ContextIcon` component is passed an `alt` prop from `utils.tsx` to
provide accessibility text. However, the component's props interface,
`ContextIconProps`, does not declare `alt`, and the function signature only destructures
the `name` and `size` props. Consequently, the `alt` prop is silently ignored by React
and not passed down to the underlying `PlatformIcon` component. This results in the
intended accessibility improvement being non-functional, as no alternative text is
rendered for the icon.
Did we get this right? 👍 / 👎 to inform future reviews.
No new public prop needed — PlatformIcon accepts HTMLImageElement
attributes via rest props, so passing alt={name} internally is enough.
Reverts the alt prop added at the call site in utils.tsx.
Co-authored-by: Ryan Albrecht <ralbrecht@sentry.io>
---
[View Session in Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC08QLT0PYQK%3A1779768843.597129%22)
Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1960079. Configure here.
Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
|
Following up on PlatformIcons and ContextIcons here: getsentry/platformicons#239 |

Screen readers depend on alt text to describe images for people who can't see them. On the issue details page, our browser/OS/device context icons were
<img>elements with noalt, so screen readers weren't relaying useful information.This PR:
alt={name}insideContextIconitself —PlatformIconacceptsHTMLImageElementattributes via rest props, so the name flows through to the<img>without adding a new public propalt=""on decorative images in the feedback panel and empty state so screen readers skip themNo call-site changes needed for context icons.
Co-authored-by: Ryan Albrecht ralbrecht@sentry.io
View Session in Sentry