简体   繁体   中英

aria-hidden property not working on descendants

Chrome Accessibility Tools complains that certain children of an overlay box do not have the right contrast ratio. It seems like the tool considers the children to be "visible" when the overlay is hidden.

I can see the aria-hidden property of the overlay being correctly set in the inspector as I open/close it, though (using attr("aria-hidden","false"); ).

Setting aria-hidden="true"; through the inspector on the children individually fixes this problem.

I am confused as aria-hidden is supposed to hide the element and its children. Does anyone know what I am doing wrong?

Thank you for your comments, it made me realise I was indeed confused by what the audit tool was checking.

I used the advice given on the w3 website regarding putting [aria-hidden="true"] { visibility: hidden; } [aria-hidden="true"] { visibility: hidden; } in my code, which properly hides the overlay when its aria-hidden property is set to true, and results in the audit tool being happy. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM