A11y: Restrict title attribute to iframe element
I'd like to consider what sniffs could be written that address programatically testable accessibility concerns.
The first is to check for the use of the title attribute, and flag it as an error, if it's not inside an iframe element.
This may well be covered with the theme check sniffs, but wanted to get discussion on this started anyway.
cc @afercia.
Related issue for the theme check sniffs: https://github.com/WPTRT/WordPress-Coding-Standards/issues/25
I think https://github.com/WPTRT/WordPress-Coding-Standards/issues/25 covers the document title (<title> tag) while @GaryJones is considering the title attribute. 😉
I started with the simple case, but with known errors of false positives.
I guess the issue here is how best to work out if title= is found inside a HTML tag.
Testing for ' title=' with a leading space could maybe reduce some false positives (at least that's what I do when scanning the WP codebase). But it could also be a line break or a tabulation...
I have been unsuccessful in reducing the false positives for WPTRT#25 ( Which is why I have not done a PR) . Perhaps we can resort to a warning, and a note that a manual check is required? Not awesome but easier. -We need to search for php as well, not only inline html, just in case.
@carolinan If your remark relates to https://github.com/WPTRT/WordPress-Coding-Standards/issues/25, you might get better feedback if you post your comment in the issue there ?
I added it here because the issues are and the sollutions will be very similar. Just confirming that I have not found a quick sollution for the false positives either.
I am not sure how you feel about this or how you have handled similar checks in the past. What I meant was that with these false positives, the sniff could be added as warning, not an error.
This test is missing a check for the title attribute in php, it only checks the inline html.