Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/platformIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ type Props = React.HTMLAttributes<HTMLDivElement | HTMLImageElement> & {
radius?: number | null;
withLanguageIcon?: boolean;
languageIconStyles?: React.CSSProperties;
/** Accessible label for the icon. Defaults to the platform name. Pass an empty string to mark the icon as decorative. */
alt?: string;
};

const PlatformIcon = ({
Expand All @@ -311,6 +313,7 @@ const PlatformIcon = ({
withLanguageIcon,
languageIconStyles = {},
style = {},
alt = platform,
...otherProps
}: Props) => {
const icon = getIcon(platform);
Expand All @@ -322,15 +325,22 @@ const PlatformIcon = ({

if (withLanguageIcon && languageIcon !== icon && languageIcon !== "default") {
return (
<div {...otherProps} style={{ position: "relative", ...style }}>
<div
{...otherProps}
role={alt === "" ? undefined : "img"}
aria-label={alt === "" ? undefined : alt}
style={{ position: "relative", ...style }}
>
Comment thread
sentry[bot] marked this conversation as resolved.
<img
src={iconPath}
width={size}
height={size}
alt=""
style={{ borderRadius: `${radius}px` }}
/>
<img
src={languageIconPath}
alt=""
style={{
position: "absolute",
bottom: "-1px",
Expand All @@ -350,6 +360,7 @@ const PlatformIcon = ({
src={iconPath}
width={size}
height={size}
alt={alt}
{...otherProps}
style={{ borderRadius: `${radius}px`, ...style }}
/>
Expand Down
Loading