Is there a way to search for all the instances where property display:none is used and add the attribute aria-hidden="true" using JavaScript.
My site has hundreds of instances of this and i am looking for a quicker way.
Could it be something like this: (added to a function)
$(*).css( "display", "none" ).attr( "aria-hidden", "true" );
The effect of aria-hidden="true" is to instruct the browser to not expose the element to the accessibility tree even if it is not hidden.
The browsers do not expose any elements to the accessibility API that are display:none.
So what you are trying to do is totally redundant. It will have absolutely zero additional affect on accessibility. Save yourself the effort and do something more productive.
use hidden() selector to identify all display none element
$( ":hidden").attr( "aria-hidden", "true" );
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With