Skip to content
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

rule: <img> has @alt attribute #2

Closed
edouard-lopez opened this issue Dec 21, 2017 · 2 comments
Closed

rule: <img> has @alt attribute #2

edouard-lopez opened this issue Dec 21, 2017 · 2 comments
Labels

Comments

@edouard-lopez
Copy link
Contributor

This will help improve accessibility.

Can be either implemented

As an instance of hasAttributes rule:

{
  selector: 'img',
  hasAttributes: 'alt'
}
  • pros:
    • reuse existing rule ;
    • so just config ;
    • can be part of a preset.
  • cons:
    • up to the user to add it

By itself

{
  selector: 'img',
  imageIsAccessible: true
}
  • pros:
    • allow more complex logic
  • cons:
    • what does accessible mean? It might lead to a complex rule that overlap with other.
@Pixelik
Copy link
Contributor

Pixelik commented Feb 8, 2018

I think we should just stick to the following set of obvious/intuitive types of checks:

isTag: '...'
children: [...]
notChildren: [...]
directChildren: [...]
notDirectChildren: [...]
attributes: [...]
notAttributes: [...]

and let the users create whatever rules they like with the above and not add extra checks that are basically wrappers of the above checks (like imageIsAccessible, typeIsText, etc..) and that the dev will have to keep in mind on top of the basic ones.

I think it will be quicker/easier for a dev to write:

{
  selector: '.my-image',
  attributes: ['alt', 'attr-2', 'attr-3', 'attr-4']
}

than :

{
  selector: '.my-image',
  imageIsAccessible: true,
  attributes: ['attr-2', 'attr-3', 'attr-4']
}

@edouard-lopez
Copy link
Contributor Author

Thanks for the feedback, as you said they are merely wrappers, moreover that would require people to learn them. While with basic rules we can make is more straightforward to use the tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants