Giter VIP home page Giter VIP logo

web-accessibility's Introduction

Web Accessibility Extension - Visual Studio Code

The MIT License GitHub Visual Studio Marketplace

⚠️ This project is no longer being actively developed or maintained. ⚠️

So I heard you wanted to write more accessible code? Well, you came to the right Extension!

This extension is here to help you get feedback on what parts need some more attention for it to be accessible, this is just the basics and doesn't cover all the rules but will help with making your project more accessible.

✨Features

The extension can do the following for you:

  • Highlight elements that you should consider changing.
  • Give a hint on how you should change it.

🔒Extension Settings

The settings can be found at File > Preferences > Settings > Extensions > Web Accessibility

Settings Type Default
Max Number Of Problems number 100
Semantic HTML boolean true

📝Release Notes

All notable changes to this project will be documented in the Changelog.

Develop

  1. type in the terminal:

    # install dependencies
    $ npm install
  2. Open debug panel in VScode and RUN "Launch Client"

  3. Open a project which contains a HTML file and see the linting in action.

  4. Build vsce package

  5. Publish vsce publish

💚License

Do what you want with the code it's MIT Licensed!

😄Misc

Follow Me: Medium, GitHub, Twitter

© Max van der Schee 2018

web-accessibility's People

Contributors

availity-bot avatar dependabot[bot] avatar ecerta avatar gilles-leblanc avatar goatandsheep avatar hm-lee avatar mvdschee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

web-accessibility's Issues

Can you document the tests which are run?

Love this extension but I'd like to know more.

Is your feature request related to a problem? Please describe.
I want to know what tests are being run.

Describe the solution you'd like
A doc page with a list of the tests.

Thanks!

Attribute binding in Angular

Describe the bug
In Angular we use attribute binding, but the plugin doesn't support it.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple angular project
  2. Write this to template: <img [src]="folder.Icon" [alt]="folder.Label"> or this: <img [src]="folder.Icon" [attr.alt]="folder.Label">
  3. See error: Provide an alt text that describes the image, or alt="" if image is purely decorative

Expected behavior
I expect to accept and handle both of these definitions as a correct solutions, because these are Angular specific goog practices.

Visual Studio Code (please complete the following information):

  • Version 1.55.2

Additional context
This expected behavior expected with any attributes.

Language support for alt texts

Is your feature request related to a problem? Please describe.
When I'm developing in portuguese, I need a way to config "nonDescriptiveAlts" and "badAltStarts" to the native language.

Describe the solution you'd like
An option to change the language.

Describe alternatives you've considered
Maybe a file with the translations
ex:

badAltStarts {
 'pt-br': [
   'alt="imagem de',
   'alt="foto de'
   ]
 'en-us': [
   'alt="image of',
   'alt="picture of'
   ]
}

Flag tabindex when greater than 0

Is your feature request related to a problem? Please describe.
tabindex should only ever have a value of 0 or -1, except in SUPER RARE exceptions in which case the developer would know enough about tabindex to ignore the linter.

This is an accessibility issue because messing with tabindex messes with keyboard accessibility in ways many developers do not realize.

Describe the solution you'd like
Add a check for tabindex=, then any number following that is greater than 0

Describe alternatives you've considered
It is possible to leave this off because again, there are very, very rare cases where tabindex greater than 0 is warranted, such as a page with a circular structure, but far more common is developers thinking they're helping their page by putting tabindex=1 on the logo at the top of the page, not realizing that this can interfere in cases where, for example, a modal closes and focus should return to where it was before it opened but instead it jumps to the top of the page.

Additional context
More info on tabindex: https://webaim.org/techniques/keyboard/tabindex

Meta viewport recommendation of adding user-scalable displays after fix

Describe the bug
For a viewport meta tag with content without user-scalable, it displays the "Enable piching to zoom.." recommendation. After adding it to the content, the recommendation still shows.

To Reproduce
Steps to reproduce the behavior:

  1. In an HTML file, have:
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">

Expected behavior
Recommendation should not display once the user-scalable is added.

Screenshots
2019-04-24 17_58_14-WebAccessibility VS Code Extension

Visual Studio Code (please complete the following information):

  • Version 1.34.0-insider (user setup)
  • Windows Version 10.0.16299.1087

Additional context
Restarted VSCode several times after making the change. Also disabled all the other extensions to verify it wasn't something that was colliding with another extension.

aria-label Warning on aria-hidden elements

Describe the bug
I'm getting a warning to provide an aria-label on elements that are both hidden & aria-hidden="true". Since this element is hidden from screen-readers, there is no need for a label.

To Reproduce
Steps to reproduce the behavior:

  1. Include <input type="hidden" aria-hidden="true" name="contact[tags]" value="newsletter">

Expected behavior
When adding either hidden or aria-hidden="true" attributes, the warning should be silenced.

Screenshots
image

Visual Studio Code (please complete the following information):

  • Version 1.37.1

Support for Font Awesome <span> technique

The extension currently highlights a Font Awesome spans and tags, expecting a role to be added, e.g.
<span class="fa fa-phone pe-color pe-small-icon" role=></span>

If the extension recognised, for instance, aria-hidden='true this would really save a lot of corrective development time.

I've tried adding roles to the spans, but this isn't necessarily a valid option.

Support inside PHP file

Is there a way for this plugin to work inside a PHP file to ensure that the HTML written inside the .php files have proper accessibility? I looked at the extension settings but didn't find a way for it to make it work inside a .php file.

Lint for duplicate id's

Is your feature request related to a problem? Please describe.
Screen readers depend on the id attribute to correctly associate labels, aria-describedby's and aria-labelledby's. Duplicate id's confuse them, and are just plain old bad code.

Describe the solution you'd like
Have the linter check if an id has been used before on the page, and throw an error if so.

Describe alternatives you've considered
It's possible a user is using other good HTML linters to check for this issue, but I think it's still worth including in this one.

Support Pug

Is your feature request related to a problem? Please describe.
For now, there is no other A11y checker on PUG

Describe the solution you'd like
Support PUG

  1. Highlight elements that you should consider changing.
  2. Give a hint on how you should change it.

Describe alternatives you've considered
No

Additional context
No. Thanks.

Title check does not trigger when <head> is empty and right next to </head>

Describe the bug
The check to be sure there is a <title> attribute between <head> tags does not trip if the <head> tags are empty and right next to each other.

To Reproduce

Expected behavior
The linter should trip when <header> tags are empty and consecutive.

Screenshots
If applicable, add screenshots to help explain your problem.
consecutive opening and closing head tags with no title attribute. No linter underline.

Note: Anything at all separating <head> tags, including space or newline, does trip the linter.
consecutive opening and closing head tags with no title attribute, this time with a space between. Linter underline present.

Visual Studio Code (please complete the following information):

  • Version 1.29.1

Additional context
This will probably be a pretty rare problem since most devs do make use of the <header> space for one thing or another if not <title> tags, but it's a fun edge case to put to bed.

ARIA role rules applied too broadly

export async function validateSpan(m: RegExpExecArray) {

Based on a discussion with an expert in web-a11y.slack.com, non-semantic elements like span and div are not required to have roles, and enforcing the application of a role on an element that doesn't need one may hurt accessibility.

The suggestion is to modify this rule / test so that it doesn't automatically flag any span or div without a role, at least when settings are at their default.

Thank you.

Support aria-labelledby

For some elements, this extension recommends using aria-label attribute or <label for=""> to provide a label for that element. I would like that aria-labelledby be included in this validation rule too.

Support for HTML-like languages

Is your feature request related to a problem? Please describe.
Plugin don't work with HTML-like languages, e.g. Nunjucks, Handlebars, etc. It doesn't work even if extension of file is .html.

Describe the solution you'd like
Added the ability to select extensions in plugin settings.

Describe alternatives you've considered
Default support for all html-like languages.

Option to disable semantically transparent elements highlight

Is your feature request related to a problem? Please describe.
It's sometimes better to use divs for wrapper elements that are necessary to implement complex layouts, not every div or span is bad if used with concious.

Describe the solution you'd like
An option in preferences to disable/enable semantically transparent elements highlight about Use semantic HTML5 or specify WAI-ARIA role, or an option to disable this monit on particular chosen elements (if possible)

Commented code still shows errors

Code in comment blocks still triggers errors
ex.
<!-- <img src="placeholder.png" class="thumbnail"> -->
still shows

Provide an alt text that describes the image, or alt="" if image is purely decorative

More and better linting in alt text

Is your feature request related to a problem? Please describe.
First, the linter currently flags a non-issue. Best practice for images of purely decorative text is an empty alt, like so: <img src="decorative_scribble.png" alt="">

Second, there's a lot of other bad alts that can be caught with their own tests, including:

  • Crummy alts, like alt="image"
  • Bad practice alt opening, like alt="image of a white dog on a green couch". "image of," "picture of" etc. are not recommended for alt openings.
  • Alt text that is too long. Most modern screen readers cut off reading alt text at 125 characters.

Describe the solution you'd like
Improvements to the image alt linter to account for these cases.

Describe alternatives you've considered
I suppose there's a question on whether these should all be grouped together in the validateImg function or broken out into separate tests, but I do think this would be a great addition either way.

Additional context
I'm already working on this! Hope I didn't jump the gun here. Also, more information on good alt text: https://webaim.org/techniques/alttext/

[request] eslint plugin

Is your feature request related to a problem? Please describe.
I can't use npm to run the lint

Describe the solution you'd like
A second program that used the logic of this as an eslint plugin

Describe alternatives you've considered
None of the other HTML lints have the a11y linters yours has

Accessibility standard

hey, thanks for the great tool,

but do you plan to follow a specific accessibility standard? e.g. WCAG?, 508 etc?

Do we have support for prime-ng tags as well?

In my HTML page I use a mix of HTML and Prime NG tags , I see that html accessibility issues are highlighted, but not prime ng tags. Is there a plan to support prime-ng tags as well.
Thanks in advance

Error: Cannot find module './patterns' - server not restarted after 3rd try

Open a directory:

Error: Cannot find module './patterns'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
    at Function.Module._load (internal/modules/cjs/loader.js:528:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:15:17)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:205:3)
    at Module._compile (internal/modules/cjs/loader.js:711:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
[Info  - 11:52:50 PM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:604
    throw err;
    ^

Error: Cannot find module './patterns'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
    at Function.Module._load (internal/modules/cjs/loader.js:528:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:15:17)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:205:3)
    at Module._compile (internal/modules/cjs/loader.js:711:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
[Info  - 11:52:50 PM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:604
    throw err;
    ^

Error: Cannot find module './patterns'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
    at Function.Module._load (internal/modules/cjs/loader.js:528:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:15:17)
    at Object.<anonymous> (/home/pdxweb/.vscode-insiders/extensions/maxvanderschee.web-accessibility-0.2.4/server/out/server.js:205:3)
    at Module._compile (internal/modules/cjs/loader.js:711:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
[Error - 11:52:50 PM] Connection to server got closed. Server will not be restarted.

** VS Code version - 1.33.0-insider **

Support single quotes in html templates

Is your feature request related to a problem? Please describe.
We are using single quotes in our ejs template to work around it breaking when we serialize it into JSON. The Web Accessibility extension still complains about for example the alt text missing though it's there, it's just using single quotes.

Describe the solution you'd like
Support single quotes or allow it to be toggled in options.

Make sure all frames and iframes have a title attribute

Is your feature request related to a problem? Please describe.
Any time you have any kind of frame, it should have a title attribute with words inside. (Note, not a <title> element, a title attribute, as in <iframe title="Why You Should Make Issues on Github Video">).

Describe the solution you'd like
Add a check for the linter that any and all frames or iframes have a title attribute.

Describe alternatives you've considered
I just think it's within the power of a linter like this to check for it and it's an a11y requirement, so let's go for it.

Additional context
https://webaim.org/techniques/frames/

[div onclick="doStuff()"] should trigger an error

Is your feature request related to a problem? Please describe.
Dev's will commonly use <div> elements for buttons when they should be using <button> elements instead.

Describe the solution you'd like
<div onclick="doStuff()"> should trigger an error different to the typical "Use Semantic HTML5 or specify a WAI-ARIA role [role=""]" warning.

It should say something like "Use a <button> element instead of a <div> element for interactive controls."

alt={`${user}`} shows error

Code with expressions in the alt attribute shows an error:
<img className="avatar" src={userAvatar} alt={${user} avatar} />
Error: Provide an alt text that describes the image, or alt="" if image is purely decorativeweb accessibility.

Don't show alerts on multiple line tag definitions

Describe the bug
Don't show alerts on multiple line tag definitions.

To Reproduce
If I use multiple lines for HTML tags, like below, the plugin don't show any alerts, warnings, or errors:

<input
  type="password"
  maxlength="3"
/>

I know this is not a standard of code usage, but it is acceptable if we want.

If I change to this format, the plugin works as I expect:

<input type="password" maxlength="3">

Expected behavior
I expect alerts on multiline tags too, because of max-line-length rule of linters I use multiline tags in many cases.

Visual Studio Code (please complete the following information):

  • VSCode version: 1.55.1
  • Plugin version: 0.2.83

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.