-
Notifications
You must be signed in to change notification settings - Fork 776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvements for utils.isHidden #166
Comments
Interesting. You confirmed something I've been wondering about myself. I'll have a go at it. Maybe memoization could help out here. We are touching that function an awful lot after all. |
Have you considered checking the CSS offsetWidth , offsetHeight etc. (I use offsetTop and offsetLeft too - but I'm not sure that is necessary). If something is display:none these should be 0 (or null in some browsers). This avoids walking up the DOM tree to find out if an ancestor is hidden. |
@jnurthen If you look at the code, you will see that it is a bit more complicated than just display:none https://github.com/dequelabs/axe-core/blob/master/lib/core/utils/is-hidden.js but we could possibly improve the performance somewhat by doing that test first and then the other tests. Anyone want to take a shot at doing that? |
I question a little your testing of aria-hidden here. I think (only a 5 minute look so apologies if incorrect) that your isHidden routine gets called on nodes when excludeHidden is not set to false in a rule. I don't think it is correct to exclude nodes hidden using aria-hidden=true from a colour contrast check, only nodes hidden using techniques which hide from nodes visually should be excluded from contrast checks. I really think you need either 2 different isHidden checks or remove the aria-hidden check from this basic check which prevents the node even getting checked by the real check and check aria-hidden in the actual rule when appropriate. Testcase for why this fails at http://output.jsbin.com/xulehoniyu. |
@jnurthen Can you open a separate issue for that specific rule? |
Had a feeling you would say that |
I evaluated axe-core with Firefox performance tools, running it in http://www.html5accessibility.com/html5elements/ page. I saw that
utils.isHidden
costs about 20% of the total execution time ofaxe.a11yCheck
call. On this particular page that equates to about 200ms. Thoughts on improving performance in that method? I'm happy to chip in or share ideas, but wanted to capture the issue first.The text was updated successfully, but these errors were encountered: