Should an Accordion panel have aria-hidden?

The accessibility specification on W3.org recommends using attributes like aria-expanded on an accordion’s header element to signify when an accordion is open or closed.

However, when an accordion is collapsed, the panel content is hidden, and it is usually good practice to mark hidden content with aria-hidden=‘true’. Mozilla’s docs for aria-hidden outline exceptions for the aria-hidden rule, but they don’t currently mention this use case.

My question: Is it better, worse or redundant to also add aria-hidden=‘true’ to the panel element when the accordion is collapsed?

The first ARIA rule says, don’t use it unless you really need it.
In fact, you should hide your panel with display:none or visibility:hidden, but not aria-hidden=true.

Attribute aria-hidden should normally be used when the content must be hidden to screen reader and other assistive tools, while visible on screen.

If the content must be hidden for everybody, screen reader or not, you should rather use display:none or visibility:hidden instead.

Then as the doc copied in the other answer says, display:none or visibility:hidden are enough on their own, aria-hidden=true is superfluous. The big risk in adding it isn’t creating bugs, but forgetting to remove it afterwards when the panel becomes visible, at which point your content become visible but totally inaccessible.

This aria-hidden=true look very practical, but it is in fact used incorrectly 99% of the times when display:none is enough, much simpler, and almost without any risk to forget about it. Attribute aria-hidden=true should only be used in very specific cases, and these cases are quite rare.
Its use getting widespread causes often more harm than it actually helps improving the experience for screen reader users, and believe me, I’m myself a blind user.

The MDN doc copied in the other answer miss a very important point.
If the content has any interactive / focusable element, you really must not use aria-hidden=true.
Otherwise, a screen reader will behave weirdly when that element is focused: it has to read something, but it isn’t supposed to read something hidden; and the focusable element can be reached with tab but not with arrow keys, what is very confusing for the user.

It depends on what is hidden. If the content is relevant to the user and the user needs to know about the hidden content, don’t add the attribute, so assistive technologies present that content to the user.

If the content is unimportant/redundant and non-interactive, add the attribute, so assistive technologies can ignore it. Thereby, you are streamlining the experience for the user relying on that technology.

As per MDN docs:

The aria-hidden attribute can be used to hide non-interactive content
from the accessibility API.

Adding aria-hidden=”true” to an element removes that element and all
of its children from the accessibility tree. This can improve the
experience for assistive technology users by hiding:

  • Purely decorative content, such as icons or images
  • Duplicated content, such as repeated text
  • Offscreen or collapsed content, such as menus

The presence of the aria-hidden attribute hides content from assistive
technology but doesn’t visually hide anything.

MDN also lists some technological criteria for when to omit aria-hidden:

aria-hidden=”true” should not be used on elements that can receive focus. Additionally, since this attribute is inherited by an element’s children, it should not be added onto the parent or ancestor of a focusable element.

aria-hidden=”true” should not be added when:

  • The HTML hidden attribute is present
  • The element or the element’s ancestor is hidden with display: none
  • The element or the element’s ancestor is hidden with visibility: hidden

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật