Mini Cart
A lightweight flyout cart panel that opens from the page header, keeping the rest of the page accessible and operable while item counts and removals are announced to assistive technology.
Demo
Click the cart trigger button to open the mini cart panel. Once open, try removing an item and observe how the item count and total update. Press Escape or click outside the panel to close it. Use the keyboard to verify that focus moves into the panel on open and returns to the trigger button on close.
What to Observe
- Opening the panel moves keyboard focus inside it, so users do not have to Tab through the entire page to reach the cart contents.
- Closing the panel — whether by pressing Escape, using the close button, or clicking outside — returns focus to the trigger button that opened it.
- The cart is non-modal: the rest of the page remains operable and visible, and background content is not made inert.
- Removing an item from the mini cart triggers a live-region announcement of the updated item count so screen reader users are informed immediately.
- The trigger button badge that shows the item count is a decorative count only; the button's accessible name conveys the count in text (e.g., "Cart, 3 items").
Anatomy
[Anatomy image placeholder — will be added when assets are available]
- Cart trigger button: A header button that opens and closes the mini cart panel; its accessible name includes the current item count.
- Item count badge: A visual indicator overlaid on the cart icon showing the number of items; decorative and backed by text in the button's accessible name.
- Mini cart panel: The flyout container that holds the item list, order summary, and action buttons; it is non-modal and does not trap focus.
- Line item: A compact row displaying a product's image, name, quantity, and price, along with a remove action.
- Remove button: Deletes a line item from the cart; its accessible name includes the product name to distinguish it from other remove buttons.
- Live region: An ARIA live region that announces item removals and updated totals to screen readers without requiring manual navigation.
Accessibility Behavior
- When the panel opens, focus moves to its heading or first focusable element so keyboard and screen reader users can immediately interact with cart contents.
- When the panel closes, focus returns to the cart trigger button that opened it, preserving the user's place in the page.
- The panel does not trap focus — Tab can move out of it into the rest of the page, reinforcing the non-modal nature of the control.
- Each remove button uses a unique accessible name that includes the product name, preventing all remove buttons from sounding identical to screen reader users.
- Item removal and total changes are communicated via a polite live region, giving users feedback without interrupting other announcements.
- The cart trigger button's accessible name reflects the current item count so screen reader users can check their cart status without opening the panel.
Common Mistakes
- Failing to move focus into the panel when it opens, forcing keyboard users to Tab through the entire page before they can interact with cart contents.
- Not returning focus to the trigger button on close, leaving keyboard users stranded at an unpredictable location in the document.
- Implementing the panel as a modal (trapping focus and using role="dialog") when the page behind it remains fully visible and operable, creating a confusing modal experience.
- Using generic "Remove" labels on all remove buttons so screen reader users cannot tell which item they are about to delete.
- Omitting a live region so that item removal produces no screen reader feedback and users must navigate away to confirm the action took effect.
Why This Matters
The mini cart is often the fastest path to checkout, so its accessibility directly affects whether users with disabilities can complete a purchase. A keyboard user who cannot get focus into the panel, or who loses their place in the page when it closes, faces a significant barrier at the most critical step of the shopping journey. Screen reader users who receive no feedback when removing an item may remove the wrong product or repeat the action unnecessarily. A well-implemented mini cart ensures that every user can review and manage their cart quickly and with confidence.
Accessibility Validation
This component is validated against internal accessibility criteria aligned with WCAG standards, using our internally developed system, Resonance Specs.
To learn more, please contact us.
Code