addyosmani/a11y

Show total number of elements violating a rule

Closed this issue · 2 comments

Somewhat related to #40

Right now, the results look like there are only 5 elements violation a given rule, and it is a bit misleading.

  ✖ Images should have an alt attribute

  body > .container.ptl > .content > DIV:nth-of-type(2) > .exampleOutput > .gravatar.gravatar-sm > IMG
  body > .container.ptl > .content > DIV:nth-of-type(2) > .exampleOutput > DIV:nth-of-type(2) > IMG
  body > .container.ptl > .content > DIV:nth-of-type(3) > .exampleOutput > .gravatar.gravatar-sm > IMG
  body > .container.ptl > .content > DIV:nth-of-type(3) > .exampleOutput > .gravatar.gravatar-sm.mlxl > IMG
  body > .container.ptl > .content > DIV:nth-of-type(3) > .exampleOutput > DIV:nth-of-type(3) > IMG

The google accessibility audit outputs the total number of elements by each rule (e.g. (1 - 5 of 30)). It would be nice if a11y included this in the output as well.

  ✖ Images should have an alt attribute (1 -5 of 30)
...

Similarly, the API could have a numElements property

{
  elements: '\nbody > .container.ptl > .content > .section-nav > LI > A\n...',
  numElements: 30,
  heading: 'Text elements should have a reasonable contrast ratio',
  result: 'FAIL',
  severity: 'Warning' 
}

Would you be open to a PR?

cc/ @gpleiss, @matt-royal, @stubbornella, @ctaymor

This should be tackled and in a release as of #43. Is there anything further we need to change here?

Hi @addyosmani, @matt-royal and I are on the same team as @kennyw12. This meets our team's needs and can now be closed.

Thanks!
The Pivotal UI Team
@atomanyih @ctaymor @gpleiss @kennyw12 @matt-royal @stubbornella