Skip to content

Commit

Permalink
Merge pull request #53 from NYPL/SCC-3899/focus-ring-a11y-fix
Browse files Browse the repository at this point in the history
SCC-3899: Focus ring accessibility fix
  • Loading branch information
EdwinGuzman authored Dec 11, 2023
2 parents 5f63115 + dd33d89 commit e7acb96
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ const Layout = ({
text: "Research Catalog",
},
]}
__css={{
a: {
_focus: {
outlineColor: "ui.white",
},
},
}}
/>
<div className={styles.researchHeadingContainer}>
<Heading id="heading-h1" level="h1" text="Research Catalog" />
Expand Down
15 changes: 14 additions & 1 deletion src/components/RCLink/RCLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface RCLinkProps {
children: ReactNode
className?: string
color?: string
hasWhiteFocusRing?: boolean
}

/**
Expand All @@ -20,11 +21,23 @@ const RCLink = ({
href,
children,
active = false,
hasWhiteFocusRing = false,
...rest
}: RCLinkProps) => {
return (
<Link href={href} passHref>
<DSLink className={className} fontWeight={active && "bold"} {...rest}>
<DSLink
className={className}
fontWeight={active && "bold"}
{...rest}
__css={
hasWhiteFocusRing && {
_focus: {
outlineColor: "ui.white",
},
}
}
>
{children}
</DSLink>
</Link>
Expand Down
3 changes: 3 additions & 0 deletions src/components/SubNav/SubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const SubNav = ({ activePage }: SubNavProps) => {
: undefined
}
active={activePage === "search" || activePage === "advanced"}
hasWhiteFocusRing
>
Search
</RCLink>
Expand All @@ -32,6 +33,7 @@ const SubNav = ({ activePage }: SubNavProps) => {
href="/subject_headings"
active={activePage === "shep"}
aria-current={activePage === "shep" ? "page" : undefined}
hasWhiteFocusRing
>
Subject Heading Explorer
</RCLink>
Expand All @@ -41,6 +43,7 @@ const SubNav = ({ activePage }: SubNavProps) => {
href="/account"
active={activePage === "account"}
aria-current={activePage === "account" ? "page" : undefined}
hasWhiteFocusRing
>
My Account
</RCLink>
Expand Down

0 comments on commit e7acb96

Please sign in to comment.