Skip to content
ShopifyRule: aria-hidden-focus•Reviewed Oct 2026

Prevent focusable elements inside aria-hidden containers in Shopify

Containers hidden with `aria-hidden="true"` must not contain links, buttons, or inputs that can receive keyboard focus.

What's wrong

Drawer carts, sliding mobile navigation panels, or modal dialogs that are closed often keep `aria-hidden="true"` while inner buttons remain in the tab order.

Who it affects

Keyboard navigators tab into invisible elements on the page while screen readers remain completely silent, causing disorientation.

How to fix on Shopify

When closing drawer carts or popups, apply the HTML `hidden` attribute or `inert` attribute, or remove inner elements from the focus order with `tabindex="-1"`.

Code example

Problematic Code
LIQUID
<div id="CartDrawer" aria-hidden="true" class="cart-drawer is-closed">
  <button type="button" class="btn-checkout">Checkout</button>
</div>
Recommended Accessible Code
LIQUID
<div id="CartDrawer" aria-hidden="true" inert class="cart-drawer is-closed" hidden>
  <button type="button" tabindex="-1" class="btn-checkout">Checkout</button>
</div>

How to check your fix

Close the drawer or modal, then press Tab repeatedly through the page. Verify that focus never lands on hidden links or buttons inside the closed panel.

Check if your site has this issue

Scan any public store page free against WCAG 2.2 AA in 30 seconds.

Your session has ended

Sign in again to carry on. Anything you typed on this page is kept.

Signed in another way? Use another method (opens a new tab)