How do we handle `aria-expanded="false/true"` in the Mini Cart Builder?

Hi,

In beta testing, I have created a menu cart counter and Google Lighthouse is getting the error [aria-*] attributes do not match their roles. How do we fix this? Because the value needs to be updated as the offcanvas cart is opened and closed.

Hi Victor,
It would be great if you could provide more context, since no one but you knows what your setup looks like and what you did :slight_smile:

Please provide at least:

  • a link to the page
  • your setup as an export/code file

Hi @timmse,

To be honest, I don’t have access to the website right now. However, I simply added a fragment element and displayed the cart item count inside it. Clicking this element opens an offcanvas panel to show the cart items. It is in this scenario that Google Lighthouse reports the error.

This is what I get – no error at all.

Just get back to us once you have access again, or if you can reproduce the problem in another installation, and provide the requested information.

Hi @timmse,

I apologize for the delay in responding. The access error occurs precisely when we set the toggle offcanvas interaction on the fragment element.

Okay. What if you assign the attribute role="button" to the dynamic fragment?
I suspect that the lighthouse warning will disappear.

It worked perfectly. Thank you @timmse