Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
14 changes: 11 additions & 3 deletions components/Nav/MobileNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ const MobileNavbar = props => {
return (
<Wrapper>
{showSideNav !== false && (
<NavButton $active={!isSideFolded} onClick={onSideToggle}>
<NavButton
$active={!isSideFolded}
onClick={onSideToggle}
aria-label={!isSideFolded ? 'Close side menu' : 'Open side menu'}
>
{isSideFolded ? <FoldIcon /> : <CloseIcon />}
</NavButton>
)}
Expand All @@ -98,11 +102,15 @@ const MobileNavbar = props => {
<Logo $compact />
</LogoLink>
<div>
<NavButton onClick={onSearchButtonClick}>
<NavButton aria-label="Search" onClick={onSearchButtonClick}>
<StyledIcon as={Search} size={28} />
</NavButton>

<NavButton onClick={onMobileNavToggle} $active={!isMobileNavFolded}>
<NavButton
onClick={onMobileNavToggle}
$active={!isMobileNavFolded}
aria-label={!isMobileNavFolded ? 'Close Navigation' : 'Open Navigation'}
>
<ArrowWrapper $shouldRotate={!isMobileNavFolded}>
<StyledIcon as={KeyboardArrowDown} size={36} />
</ArrowWrapper>
Expand Down
7 changes: 4 additions & 3 deletions components/Nav/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ModalContainer extends PureComponent {
return (
<>
<AlgoliaModalHeader $isOpen={this.props.isOpen}>
<button onClick={this.onCloseButtonClick}>
<button onClick={this.onCloseButtonClick} aria-label="Close Search Bar">
<StyledModalCloseIcon />
</button>
</AlgoliaModalHeader>
Expand All @@ -150,9 +150,10 @@ class ModalContainer extends PureComponent {
}
}

const LogoLink = styled(Link).attrs((/* props */) => ({
const LogoLink = styled(Link).attrs(({ ariaLabel }) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just pass aria-label directly on LogoLink instead of using the attrs indirection:

<LogoLink aria-label="Styled Components Home Page">

unstyled: true,
href: '/',
'aria-label': ariaLabel,
}))`
display: inline-block;
vertical-align: center;
Expand All @@ -172,7 +173,7 @@ class Navbar extends PureComponent {
<Wrapper $transparent={transparent}>
<NormalNavbar>
<StartWrapper>
<LogoLink>
<LogoLink ariaLabel="Styled Components Home Page">
<Logo />
</LogoLink>
<NavLinks />
Expand Down
2 changes: 1 addition & 1 deletion components/Nav/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const Search = ({ isDocs, className }) => {
return (
<Wrapper className={className}>
<GlobalStyles />
<Button>
<Button aria-label="Search">
<StyledSearchIcon />
</Button>
<Input id={INPUT_ID} placeholder={isDocs ? `Search ...` : `Search docs ...`} ref={searchInput} type="search" />
Expand Down
9 changes: 5 additions & 4 deletions components/Nav/Social.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ const Wrapper = styled.nav`
flex: 1 1 auto;
`;

const SocialLink = styled(Link).attrs((/* props */) => ({
const SocialLink = styled(Link).attrs(props => ({
unstyled: true,
'aria-label': props.ariaLabel,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

}))`
display: flex;
margin-right: ${rem(20)};
Expand Down Expand Up @@ -75,16 +76,16 @@ const Spectrum = () => (

const Social = props => (
<Wrapper {...props}>
<SocialLink href="https://spectrum.chat/styled-components/">
<SocialLink href="https://spectrum.chat/styled-components/" ariaLabel="Spectrum Chat">
<Spectrum />
</SocialLink>
{/* <SocialLink href="https://twitter.com/someone">
<Twitter />
</SocialLink> */}
<SocialLink href="https://github.com/styled-components">
<SocialLink href="https://github.com/styled-components" ariaLabel="GitHub">
<StyledIcon as={Github} height="18" />
</SocialLink>
<SocialLink href="https://medium.com/styled-components">
<SocialLink href="https://medium.com/styled-components" ariaLabel="Medium.com">
<StyledIcon as={MediumM} height="18" />
</SocialLink>
</Wrapper>
Expand Down
4 changes: 2 additions & 2 deletions components/Slider/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const Navigation = ({ prev, next }) => {
return (
<SlideNav>
<ShowcaseLink item={prev}>
<NavButton>
<NavButton role="button" aria-label="previous image">
<Image
width={1920}
height={1080}
Expand All @@ -123,7 +123,7 @@ const Navigation = ({ prev, next }) => {
</ShowcaseLink>

<ShowcaseLink item={next}>
<NavButton>
<NavButton role="button" aria-label="next image">
<Image
width={1920}
height={1080}
Expand Down
4 changes: 2 additions & 2 deletions components/Slider/ShowcaseBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ const ShowcaseBody = ({ title, owner, description, link, repo }) => (
{description && <p>{description}</p>}
</div>
<SlideMetaLinks>
<SlideMetaLink href={link} target="_blank">
<SlideMetaLink href={link} target="_blank" aria-label={`${title} website`}>
<span>Go to website</span>
<Globe />
</SlideMetaLink>
{repo && (
<SlideMetaLink href={repo} target="_blank">
<SlideMetaLink href={repo} target="_blank" aria-label={`${title} repository`}>
<span>Go to repository</span>
<RepoIcon url={repo} />
</SlideMetaLink>
Expand Down