Skip to content

Commit

Permalink
fix: JAWS issue in avatar (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
cansuaa authored Jul 29, 2024
1 parent f7142c7 commit 2ecdd4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pages/avatar/permutations.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function AvatarPage() {
<main>
<TestBed>
<Avatar ariaLabel="User avatar" />
<Avatar color="gen-ai" iconName="gen-ai" ariaLabel="User avatar" />
<Avatar color="gen-ai" iconName="gen-ai" ariaLabel="Gen AI assistant" />

<Avatar initials="GW" ariaLabel="User avatar GW" tooltipText="User avatar" />
<Avatar color="gen-ai" initials="GW" ariaLabel="Gen AI assistant GW" tooltipText="Gen AI assistant" />
Expand All @@ -45,8 +45,8 @@ export default function AvatarPage() {
tooltipText="Gen AI assistant generating response"
/>

<Avatar iconSvg={customIconSvg} ariaLabel="Avatar loading" />
<Avatar color="gen-ai" iconSvg={customIconSvg} ariaLabel="Gen AI assistant loading" />
<Avatar iconSvg={customIconSvg} ariaLabel="Avatar with custom SVG icon" />
<Avatar color="gen-ai" iconSvg={customIconSvg} ariaLabel="Gen AI avatar with custom SVG icon" />
</TestBed>
</main>
</ScreenshotArea>
Expand Down
4 changes: 3 additions & 1 deletion src/avatar/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export default function InternalAvatar({
/>
)}

<div className={styles.content}>
{/* aria-hidden is added so that screen readers focus only the parent div */}
{/* when it is not hidden, it becomes unstable in JAWS */}
<div className={styles.content} aria-hidden="true">
<AvatarContent
color={color}
ariaLabel={ariaLabel}
Expand Down

0 comments on commit 2ecdd4e

Please sign in to comment.