Skip to content

Commit

Permalink
fix: improve cart button accessibility (#220)
Browse files Browse the repository at this point in the history
* fix: add button label to shopping cart icon

* fix: reorder components to announce shopping cart earlier
  • Loading branch information
amberleyromo authored and jlengstorf committed Jan 11, 2019
1 parent 3e1ff1d commit 622c96b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/components/Cart/Cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ class Cart extends Component {
}`}
>
<Heading>
<CartToggle onClick={toggle}>
<CartToggle
aria-label={`Shopping cart with ${itemsInCart} items`}
onClick={toggle}
>
{status === 'open' ? (
<MdClose />
) : (
Expand Down
16 changes: 8 additions & 8 deletions src/components/Layout/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,14 @@ export default class Layout extends React.Component {
productImagesBrowserStatus={productImagesBrowserStatus}
/>
<Viewport>
<Cart
isDesktopViewport={isDesktopViewport}
status={cartStatus}
toggle={toggleCart}
contributorAreaStatus={contributorAreaStatus}
productImagesBrowserStatus={productImagesBrowserStatus}
/>

<ContributorArea
location={location}
status={contributorAreaStatus}
Expand Down Expand Up @@ -431,14 +439,6 @@ export default class Layout extends React.Component {
isDesktopViewport={isDesktopViewport}
/>
)}

<Cart
isDesktopViewport={isDesktopViewport}
status={cartStatus}
toggle={toggleCart}
contributorAreaStatus={contributorAreaStatus}
productImagesBrowserStatus={productImagesBrowserStatus}
/>
</Viewport>
</>
)}
Expand Down

0 comments on commit 622c96b

Please sign in to comment.