├── .gitattributes ├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Web Accessibility Checker.sln ├── appveyor.yml ├── art ├── browser-link-tooltip.png ├── config-file.png ├── config-intellisense.png ├── dropdown-menu.png ├── error-list-context-menu.png ├── error-list.png └── options.png ├── lib ├── Microsoft.VisualStudio.Web.BrowserLink.12.0.dll └── Microsoft.VisualStudio.Web.BrowserLink.12.0.xml └── src ├── BrowserLink ├── Axe.min.js ├── Checker.js ├── CheckerExtension.cs ├── CheckerFactory.cs └── _intellisense │ ├── browserlink.intellisense.js │ ├── jquery-1.8.2.intellisense.js │ └── jquery-1.8.2.js ├── Commands ├── ClearAllErrorsCommand.cs ├── OpenSettingsCommand.cs ├── RunNowCommand.cs ├── SpecifyRulesCommand.cs └── ToggleAutoRunCommand.cs ├── Constants.cs ├── ErrorList ├── AccessibilityResult.cs ├── ErrorListService.cs ├── SinkManager.cs ├── TableDataSource.cs └── TableEntriesSnapshot.cs ├── Helpers ├── DteHelpers.cs └── Logger.cs ├── JSON ├── CreationListener.cs └── Schema │ └── .a11yrc ├── Options.cs ├── Properties └── AssemblyInfo.cs ├── Resources ├── Icon.png └── Preview.png ├── VSCommandTable.cs ├── VSCommandTable.vsct ├── VSPackage.cs ├── Web Accessibility Checker.csproj ├── icons.pkgdef ├── source.extension.cs ├── source.extension.ico ├── source.extension.resx └── source.extension.vsixmanifest /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Installed product versions 2 | - Visual Studio: [example 2015 Professional] 3 | - This extension: [example 1.1.21] 4 | 5 | ### Description 6 | Replace this text with a short description 7 | 8 | ### Steps to recreate 9 | 1. Replace this 10 | 2. text with 11 | 3. the steps 12 | 4. to recreate 13 | 14 | ### Current behavior 15 | Explain what it's doing and why it's wrong 16 | 17 | ### Expected behavior 18 | Explain what it should be doing after it's fixed. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages 2 | node_modules.7z 3 | 4 | # User files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | .vs/ 9 | 10 | # Build results 11 | 12 | [Dd]ebug/ 13 | [Rr]elease/ 14 | x64/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # MSTest test Results 19 | [Tt]est[Rr]esult*/ 20 | [Bb]uild[Ll]og.* 21 | 22 | # NCrunch 23 | *.ncrunchsolution 24 | *.ncrunchproject 25 | _NCrunch_WebCompiler -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Road map 2 | 3 | - [ ] Nothing yet... 4 | 5 | Features that have a checkmark are complete and available for 6 | download in the 7 | [nightly build](http://vsixgallery.com/extension/25a79d25-0fff-4748-afaa-3a67ed116bc9/). 8 | 9 | # Change log 10 | 11 | These are the changes to each version that has been released 12 | on the official Visual Studio extension gallery. 13 | 14 | ## 1.5 15 | 16 | - [x] Fixed issue with require.js 17 | 18 | ## 1.4 19 | 20 | - [x] Updated axe-core to latest version 21 | - [x] Fixed issues for ASP.NET Core projects 22 | - [x] Turned off `region` rule by default 23 | - [x] Added details expander to error list 24 | 25 | ## 1.3 26 | 27 | - [x] Async package load 28 | - [x] Updated JSON Schema file 29 | - [x] Added support for axe-core 2 new rules 30 | 31 | ## 1.2 32 | 33 | - [x] Update axe-core to version 2.0.5 34 | 35 | ## 1.1 36 | 37 | - [x] Fixed bad checkmark state (#4) 38 | - [x] Delayed package load till web project opens 39 | - [x] Added a change log 40 | 41 | ## 1.0 42 | 43 | - [x] Uses Browser Link to test the running website 44 | - [x] Tests the actual DOM 45 | - [x] Integrates with the Visual Studio error list 46 | - [x] All rules can be customized per project/solution 47 | - [x] Works with all web projects supporting Browser Link -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 Mads Kristensen 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Web Accessibility Checker 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/q0xapaawd7mfxfby?svg=true)](https://ci.appveyor.com/project/madskristensen/webaccessibilitychecker) 4 | 5 | Download the extension at the 6 | [VS Gallery](https://visualstudiogallery.msdn.microsoft.com/3aabefab-1681-4fea-8f95-6a62e2f0f1ec) 7 | or get the 8 | [CI build](http://vsixgallery.com/extension/25a79d25-0fff-4748-afaa-3a67ed116bc9/) 9 | 10 | ------------------------------------------ 11 | 12 | The easiest way to perform accessibility checks 13 | on any ASP.NET web application. Fully customizable 14 | and support all the major international accessibility standards. 15 | 16 | ## Features 17 | 18 | - Uses Browser Link to test the running website 19 | - Tests the actual DOM 20 | - Integrates with the Visual Studio error list 21 | - Supports the [Web Essentials Chrome extension](https://chrome.google.com/webstore/detail/web-essentials/mghdcdlpcdiodelbplncnodiiadljhhk) 22 | - Supported accessibility standards 23 | - WCAG Level A 24 | - WCAG Level AA 25 | - Section 508 26 | - Other best practices 27 | - All rules can be customzied per project/solution 28 | - Works with MVC, WebForms, Web Pages and ASP.NET Core projects 29 | 30 | ### Connect with Browser Link 31 | 32 | For this extension to work, make sure that Visual Studio's 33 | Browser Link is up and running. Do that by running an 34 | ASP.NET application from Visual Studio in one or more 35 | browsers. 36 | 37 | Hovering over the Browser Link button on the Standard 38 | toolbar lets you know if Browser Link is connected. 39 | 40 | ![Browser Link Tooltip](art/browser-link-tooltip.png) 41 | 42 | ## Commands 43 | The Browser Link dropdown menu hosts the _Web Accessibility Checker_ 44 | sub menu. 45 | 46 | ![Dropdown menu](art/dropdown-menu.png) 47 | 48 | There are multiple command buttons in the menu. 49 | 50 | ### Auto-Run on Page Load 51 | This will automatically run the accessibility checker every 52 | time a page loads in the browser - any browser. 53 | 54 | ### Run Now in All Browsers... 55 | In addition to auto-running the checker on page load, doing it 56 | on demand can be helpful when you need to interact with the 57 | page to get it into a state you want to check. 58 | 59 | This is also a great way of running on demand only if you disable 60 | _Auto-Run on Page Load_. 61 | 62 | ### Specify Rules for Solution... 63 | Clicking this command will add a configuration file to the 64 | solution. 65 | 66 | ![a11y config file](art/config-file.png) 67 | 68 | It's a JSON file containing all the rules being run. You can 69 | customize it by adding and removing rules and there is full 70 | Intellisense for all the rules. 71 | 72 | ![Config Intellisense](art/config-intellisense.png) 73 | 74 | ### Settings 75 | Some global settings can be configured in the option dialog. 76 | 77 | ![Options dialog](art/options.png) 78 | 79 | ## Accessibility rules 80 | This extensions uses the [axe-core](https://github.com/dequelabs/axe-core) 81 | library to perform the accessibility analysis. 82 | 83 | All rules are completely customizable and can follow the 84 | project or solution. 85 | 86 | See the full 87 | [list of rules](https://dequeuniversity.com/rules/axe/1.1) 88 | 89 | ## Error list 90 | Errors found on the page will automatically populate the 91 | Error List in Visual Studio. 92 | 93 | ![Error List integration](art/error-list.png) 94 | 95 | In some cases it is known exactly where in the source code 96 | the issue is and double-clicking the error take you straight 97 | to the location. 98 | 99 | To clear all accessbility errors from the Error List, simply 100 | right-click and hit _Clear All Accessibility Errors_. 101 | 102 | ![Error List context menu](art/error-list-context-menu.png) 103 | 104 | ## Contribute 105 | Check out the [contribution guidelines](.github/CONTRIBUTING.md) 106 | if you want to contribute to this project. 107 | 108 | For cloning and building this project yourself, make sure 109 | to install the 110 | [Extensibility Tools 2015](https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6) 111 | extension for Visual Studio which enables some features 112 | used by this project. 113 | 114 | ## License 115 | [Apache 2.0](LICENSE) -------------------------------------------------------------------------------- /Web Accessibility Checker.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.25921.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web Accessibility Checker", "src\Web Accessibility Checker.csproj", "{4DFEBB60-A06B-4DB4-B7B2-782761825FC7}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{24A128A0-9038-4315-9EC8-B07EB2CD2E90}" 9 | ProjectSection(SolutionItems) = preProject 10 | appveyor.yml = appveyor.yml 11 | CHANGELOG.md = CHANGELOG.md 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {4DFEBB60-A06B-4DB4-B7B2-782761825FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {4DFEBB60-A06B-4DB4-B7B2-782761825FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {4DFEBB60-A06B-4DB4-B7B2-782761825FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {4DFEBB60-A06B-4DB4-B7B2-782761825FC7}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | 3 | install: 4 | - ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex 5 | 6 | before_build: 7 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion 8 | - ps: Vsix-TokenReplacement src\source.extension.cs 'Version = "([0-9\\.]+)"' 'Version = "{version}"' 9 | 10 | build_script: 11 | - nuget restore -Verbosity quiet 12 | - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m 13 | 14 | after_test: 15 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery 16 | 17 | before_deploy: 18 | - ps: Vsix-CreateChocolatyPackage -packageId webaccessibilitychecker 19 | 20 | deploy: 21 | - provider: Environment 22 | name: Chocolatey 23 | on: 24 | branch: master 25 | appveyor_repo_commit_message_extended: /\[release\]/ -------------------------------------------------------------------------------- /art/browser-link-tooltip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/browser-link-tooltip.png -------------------------------------------------------------------------------- /art/config-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/config-file.png -------------------------------------------------------------------------------- /art/config-intellisense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/config-intellisense.png -------------------------------------------------------------------------------- /art/dropdown-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/dropdown-menu.png -------------------------------------------------------------------------------- /art/error-list-context-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/error-list-context-menu.png -------------------------------------------------------------------------------- /art/error-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/error-list.png -------------------------------------------------------------------------------- /art/options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/art/options.png -------------------------------------------------------------------------------- /lib/Microsoft.VisualStudio.Web.BrowserLink.12.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/lib/Microsoft.VisualStudio.Web.BrowserLink.12.0.dll -------------------------------------------------------------------------------- /lib/Microsoft.VisualStudio.Web.BrowserLink.12.0.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Microsoft.VisualStudio.Web.BrowserLink.12.0 5 | 6 | 7 | 8 | Represents an Action that can be presented on the Browser Link Dashboard 9 | 10 | 11 | Initializes an instance of the BrowserLinkAction class. 12 | 13 | 14 | Initializes an instance of the BrowserLinkAction class. 15 | 16 | 17 | Menu item text 18 | 19 | 20 | True if the item should be displayed with a checkmark on the context menu 21 | 22 | 23 | True if the item should be enabled on the context menu 24 | 25 | 26 | Internal only. Invokes the callback delegate. 27 | 28 | 29 | Internal only. Invokes the update menu item delegate. 30 | 31 | 32 | True if the item should displayed on the context menu 33 | 34 | 35 | Represents an attribute that specifies a method is a browser link callback. 36 | 37 | 38 | Initializes a new instance of the BrowserLinkCallback class. 39 | 40 | 41 | Encapsulates a browser link connection between Visual Studio and a browser. 42 | 43 | 44 | 45 | The client browser display name. 46 | 47 | 48 | A unique connection identifier. 49 | 50 | 51 | Extensions attached to this connection. 52 | 53 | 54 | Fired after extensions for this connection have been created. 55 | 56 | 57 | Fires an internal event. 58 | 59 | 60 | Logs a message to the connected browser console. 61 | 62 | 63 | The Visual Studio project associated with this connection. 64 | 65 | 66 | Properties can be associated with this connection through this dictionary. Default property values can be found using keys in DefaultConnectionProperties. 67 | 68 | 69 | The client URL of this connection. 70 | 71 | 72 | Base class for browser link extensions. 73 | 74 | 75 | 76 | Returns Actions that are presented on the Browser Link Dashboard 77 | 78 | 79 | Client invoke root. 80 | 81 | 82 | Connections root. 83 | 84 | 85 | Factories root. 86 | 87 | 88 | Name of this extension. 89 | 90 | 91 | Called when the given connection has connected. Perform extension initialization here. 92 | 93 | 94 | Called when the given connection is disconnecting. Perform extension clean up here. 95 | 96 | 97 | Internal only. Initializes extension properties before we hand control to the extension author. 98 | 99 | 100 | Event arguments used for when a connection has been added or removed. 101 | 102 | 103 | 104 | Connection associated with this event. 105 | 106 | 107 | Extensible extension event object. 108 | Type to pass into the extensible event. 109 | 110 | 111 | 112 | Dispatches extensible event. 113 | 114 | 115 | Event handler for this extensible event. 116 | 117 | 118 | Extensible extension events. 119 | 120 | 121 | Constructs this object. 122 | 123 | 124 | Assign ExtensionEvent objects to this dictionary. 125 | 126 | 127 | Creates instances of browser link extension objects. 128 | 129 | 130 | Creates a BrowserLinkExtension object when a new connection is made. 131 | A BrowserLinkExtension object. 132 | The new connection. 133 | 134 | 135 | Returns the Javascript implementation of this extension. 136 | 137 | 138 | Root browser link service object. 139 | 140 | 141 | Provides access to all current client connections. 142 | 143 | 144 | Provides access to all loaded extension factories. 145 | 146 | 147 | Provides access to connection clients for remote method invocation. 148 | 149 | 150 | Provides accesses connection clients for remote method invocation. 151 | 152 | 153 | Accesses all clients. 154 | 155 | 156 | Access all clients except the ones specified. 157 | 158 | 159 | Accesses a client on a specific connection. 160 | 161 | 162 | Accesses clients of the specified connections. 163 | 164 | 165 | Permits invocation of Javascript browser link extension call backs. 166 | 167 | 168 | Invokes a client callback method. 169 | 170 | 171 | Invokes a client callback method asynchronously. 172 | Returns a Task which completes when the return value is ready. This is only supported on single connections. 173 | Method name to call. 174 | Arguments for method call. 175 | Type of return value. 176 | 177 | 178 | Interface for messaging from VS to the browser. 179 | 180 | 181 | Invokes a remote Javascript method. 182 | Browser connection to invoke against. 183 | Name of remote Javascript method to invoke. 184 | Argument list for remote Javascript method. 185 | 186 | 187 | Asynchronously invokes a remote Javascript method. 188 | Browser connection to invoke against. 189 | Name of remote Javascript method to invoke. 190 | Argument list for remote Javascript method. 191 | 192 | 193 | 194 | Browser link connections root. 195 | 196 | 197 | Fired on a new connection. 198 | 199 | 200 | Active connections. 201 | 202 | 203 | Invoked after a connection or disconnection. 204 | 205 | 206 | Fired on a disconnection. 207 | 208 | 209 | Provides access to the loaded Browser linkExtension factories. 210 | 211 | 212 | Provides access to extensible browser link events. 213 | 214 | 215 | Collection of loaded BrowserLinkExtensionFactory's. 216 | 217 | 218 | -------------------------------------------------------------------------------- /src/BrowserLink/Checker.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | (function (browserLink, $) { 4 | /// 5 | /// 6 | 7 | var _project, _options; 8 | 9 | function initialize(options, project) { 10 | _options = options; 11 | _project = project; 12 | } 13 | 14 | function runAxe(results) { 15 | 16 | results.project = _project; 17 | 18 | for (var i = 0; i < results.violations.length; i++) { 19 | 20 | var nodes = results.violations[i].nodes; 21 | 22 | if (!nodes || nodes.length === 0) 23 | continue; 24 | 25 | results.violations[i].html = nodes[0].html; 26 | 27 | var target = nodes[0].target[0]; 28 | var element = document.querySelector(target); 29 | 30 | var sourcemap = getSourceMap(element); 31 | results.violations[i].fileName = sourcemap ? sourcemap.sourcePath : ""; 32 | results.violations[i].position = sourcemap ? sourcemap.startPosition : -1; 33 | } 34 | 35 | browserLink.invoke("ProcessResult", JSON.stringify(results)); 36 | } 37 | 38 | function getSourceMap(element) { 39 | try { 40 | return browserLink.sourceMapping.getCompleteRange(element); 41 | } catch (e) { 42 | return null; 43 | } 44 | } 45 | 46 | function check() { 47 | setTimeout(function () { 48 | var json = JSON.parse(_options); 49 | axe.a11yCheck(document, json, runAxe); 50 | }, 2000); 51 | } 52 | 53 | //[axe.min.js] 54 | 55 | return { 56 | check: check, 57 | initialize: initialize, 58 | menu: { 59 | displayText: 'Web Accessibility Checker', 60 | 'Run Accessibility Checker': 'check' 61 | } 62 | }; 63 | }); -------------------------------------------------------------------------------- /src/BrowserLink/CheckerExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Reflection; 5 | using Microsoft.VisualStudio.Web.BrowserLink; 6 | using Newtonsoft.Json; 7 | using Newtonsoft.Json.Linq; 8 | 9 | namespace WebAccessibilityChecker 10 | { 11 | public class CheckerExtension : BrowserLinkExtension 12 | { 13 | private List _connections = new List(); 14 | 15 | private CheckerExtension() 16 | { } 17 | 18 | public static CheckerExtension Instance { get; } = new CheckerExtension(); 19 | 20 | public bool HasConnections => 21 | _connections.Count > 0; 22 | 23 | 24 | public override void OnConnected(BrowserLinkConnection connection) 25 | { 26 | if (connection.Project == null) 27 | return; 28 | 29 | if (!_connections.Contains(connection)) 30 | _connections.Add(connection); 31 | 32 | Browsers.Client(connection).Invoke("initialize", GetOptions(connection), connection.Project.Name); 33 | 34 | if (VSPackage.Options.RunOnPageLoad) 35 | CheckA11y(connection); 36 | 37 | base.OnConnected(connection); 38 | } 39 | 40 | public void CheckA11y(params BrowserLinkConnection[] connections) 41 | { 42 | connections = (connections == null || connections.Length == 0) ? _connections.ToArray() : connections; 43 | 44 | if (connections == null) 45 | return; 46 | 47 | foreach (BrowserLinkConnection connection in connections) 48 | { 49 | Browsers.Client(connection).Invoke("check"); 50 | } 51 | } 52 | 53 | private string GetOptions(BrowserLinkConnection connection) 54 | { 55 | var dir = new DirectoryInfo(connection.Project.GetRootFolder()); 56 | string folder = FindConfigFolder(dir); 57 | string file = Path.Combine(folder, Constants.ConfigFileName); 58 | string options = "{}"; 59 | 60 | if (File.Exists(file)) 61 | { 62 | string content = File.ReadAllText(file); 63 | var obj = JObject.Parse(content, new JsonLoadSettings { CommentHandling = CommentHandling.Ignore }); 64 | options = obj.ToString(); 65 | } 66 | 67 | return options; 68 | } 69 | 70 | public override void OnDisconnecting(BrowserLinkConnection connection) 71 | { 72 | if (_connections.Contains(connection)) 73 | _connections.Remove(connection); 74 | 75 | base.OnDisconnecting(connection); 76 | } 77 | 78 | protected virtual string FindConfigFolder(DirectoryInfo dir) 79 | { 80 | while (dir != null) 81 | { 82 | string rc = Path.Combine(dir.FullName, Constants.ConfigFileName); 83 | if (File.Exists(rc)) 84 | return dir.FullName; 85 | 86 | dir = dir.Parent; 87 | } 88 | 89 | string bin = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 90 | return Path.Combine(bin, "JSON\\Schema"); 91 | } 92 | 93 | [BrowserLinkCallback] 94 | public void ProcessResult(string jsonResult) 95 | { 96 | try 97 | { 98 | AccessibilityResult result = JsonConvert.DeserializeObject(jsonResult); 99 | ErrorListService.ProcessLintingResults(result); 100 | } 101 | catch (Exception ex) 102 | { 103 | Logger.Log(ex); 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/BrowserLink/CheckerFactory.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.IO; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Web.BrowserLink; 7 | 8 | namespace WebAccessibilityChecker 9 | { 10 | [Export(typeof(IBrowserLinkExtensionFactory))] 11 | public class CheckerFactory : IBrowserLinkExtensionFactory 12 | { 13 | static SolutionEvents _solutionEvents; 14 | static readonly string _script; 15 | 16 | static CheckerFactory() 17 | { 18 | var dte = (DTE2)Package.GetGlobalService(typeof(DTE)); 19 | _solutionEvents = dte.Events.SolutionEvents; 20 | _solutionEvents.AfterClosing += SolutionEvents_AfterClosing; 21 | _solutionEvents.ProjectRemoved += _solutionEvents_ProjectRemoved; 22 | 23 | string checkerJs = GetScriptFromAssembly("WebAccessibilityChecker.BrowserLink.Checker.js"); 24 | string axeJs = GetScriptFromAssembly("WebAccessibilityChecker.BrowserLink.Axe.min.js"); 25 | 26 | _script = checkerJs.Replace("//[axe.min.js]", axeJs); 27 | } 28 | 29 | public BrowserLinkExtension CreateExtensionInstance(BrowserLinkConnection connection) 30 | { 31 | if (connection.Project == null || !VSPackage.Options.Enabled) 32 | return null; 33 | 34 | return CheckerExtension.Instance; 35 | } 36 | 37 | public string GetScript() 38 | { 39 | return _script; 40 | } 41 | 42 | private static string GetScriptFromAssembly(string path) 43 | { 44 | using (Stream stream = typeof(CheckerFactory).Assembly.GetManifestResourceStream(path)) 45 | using (var reader = new StreamReader(stream)) 46 | { 47 | return reader.ReadToEnd(); 48 | } 49 | } 50 | 51 | static void _solutionEvents_ProjectRemoved(Project Project) 52 | { 53 | TableDataSource.Instance.CleanAllErrors(); 54 | } 55 | 56 | static void SolutionEvents_AfterClosing() 57 | { 58 | TableDataSource.Instance.CleanAllErrors(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/BrowserLink/_intellisense/browserlink.intellisense.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | var bl = { 5 | 6 | "invoke": function () { 7 | /// 8 | /// Calls a server method defined in the Visual Studio BrowserLink extension. 9 | /// The name of the server method 10 | /// 11 | /// 12 | /// Calls a server method defined in the Visual Studio BrowserLink extension and sends data. 13 | /// The name of the server method 14 | /// An object to send as a parameter of the server method. 15 | /// 16 | }, 17 | 18 | "invokeAsync": function () { 19 | /// 20 | /// Calls a server method defined in the Visual Studio BrowserLink extension. 21 | /// The name of the server method 22 | /// 23 | /// 24 | /// 25 | /// Calls a server method defined in the Visual Studio BrowserLink extension. 26 | /// The name of the server method 27 | /// An object to send as a parameter of the server method. 28 | /// 29 | /// 30 | }, 31 | 32 | /// The isolated BrowserLink JSON object. 33 | "json": JSON, 34 | 35 | 36 | "log": function () { 37 | /// 38 | /// Logs a message to the browser console. 39 | /// The message to log. 40 | /// 41 | }, 42 | 43 | /// The server-side source mapping data. 44 | "sourceMapping": { 45 | "canMapToSource": function () { 46 | /// 47 | /// Checks if the specified DOM element can be mapped to server source. 48 | /// The DOM element to test against server-side mapping. 49 | /// 50 | /// 51 | }, 52 | 53 | "ensureUpToDateAsync": function(){ 54 | /// 55 | /// Makes sure source mapping has been loaded and then calls the callback function. 56 | /// A function callback that take no parameters. 57 | /// 58 | /// 59 | }, 60 | 61 | "getCompleteRange": function () { 62 | /// 63 | /// Checks if the specified DOM element can be mapped to server source. 64 | /// The DOM element to test against server-side mapping. 65 | /// 66 | /// 67 | }, 68 | 69 | "getElementAtPosition": function () { 70 | /// 71 | /// Checks if the specified DOM element can be mapped to server source. 72 | /// The absolute path to the source file. 73 | /// The position in the source file. 74 | /// 75 | /// 76 | }, 77 | 78 | "getStartTagRange": function () { 79 | /// 80 | /// Checks if the specified DOM element can be mapped to server source. 81 | /// The DOM element to test against server-side mapping. 82 | /// 83 | /// 84 | }, 85 | 86 | "selectCompleteRange": function () { 87 | /// 88 | /// Checks if the specified DOM element can be mapped to server source. 89 | /// The DOM element to test against server-side mapping. 90 | /// 91 | }, 92 | 93 | "selectStartTagRange": function () { 94 | /// 95 | /// Checks if the specified DOM element can be mapped to server source. 96 | /// The DOM element to test against server-side mapping. 97 | /// 98 | }, 99 | 100 | /// Contains information about the browser and connection. 101 | "initializationData": { 102 | 103 | /// The name of the connected browser. 104 | "appName": "", 105 | 106 | /// The ID of the SignalR connection to Visual Studio. 107 | "requestId": "", 108 | }, 109 | } 110 | }; 111 | 112 | var sourceMap = function () { 113 | return { 114 | /// The absolute file path of the file containing the element on disk. 115 | "sourcePath": "", 116 | 117 | /// The start position of the DOM element in the 'sourcePath' file. 118 | "startPosition": 1, 119 | 120 | /// The length of the DOM element in the 'sourcePath' file. 121 | "length": 1, 122 | } 123 | }; 124 | 125 | var Promise = function () { 126 | return { 127 | "continueWith": function () { 128 | /// 129 | /// Is called when the server replies with a value. 130 | /// 131 | /// 132 | /// The return value from the server. 133 | /// 134 | /// 135 | /// 136 | } 137 | } 138 | } -------------------------------------------------------------------------------- /src/Commands/ClearAllErrorsCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.Shell; 6 | 7 | namespace WebAccessibilityChecker 8 | { 9 | internal sealed class ClearAllErrorsCommand 10 | { 11 | private readonly Package _package; 12 | private readonly BuildEvents _events; 13 | 14 | private ClearAllErrorsCommand(Package package, OleMenuCommandService commandService) 15 | { 16 | _package = package; 17 | 18 | var dte = (DTE2)Package.GetGlobalService(typeof(DTE)); 19 | _events = dte.Events.BuildEvents; 20 | _events.OnBuildBegin += OnBuildBegin; 21 | 22 | if (commandService != null) 23 | { 24 | var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.ClearAllErrors); 25 | var cmd = new OleMenuCommand(MenuItemCallback, id); 26 | cmd.BeforeQueryStatus += BeforeQueryStatus; 27 | commandService.AddCommand(cmd); 28 | } 29 | } 30 | 31 | public static ClearAllErrorsCommand Instance { get; private set; } 32 | 33 | private IServiceProvider ServiceProvider 34 | { 35 | get { return _package; } 36 | } 37 | 38 | public static void Initialize(Package package, OleMenuCommandService commandService) 39 | { 40 | Instance = new ClearAllErrorsCommand(package, commandService); 41 | } 42 | 43 | private void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) 44 | { 45 | if (Action == vsBuildAction.vsBuildActionClean || Action == vsBuildAction.vsBuildActionRebuildAll) 46 | { 47 | TableDataSource.Instance.CleanAllErrors(); 48 | } 49 | } 50 | 51 | private void BeforeQueryStatus(object sender, EventArgs e) 52 | { 53 | var button = (OleMenuCommand)sender; 54 | button.Enabled = TableDataSource.Instance.HasErrors; 55 | } 56 | 57 | private void MenuItemCallback(object sender, EventArgs e) 58 | { 59 | TableDataSource.Instance.CleanAllErrors(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Commands/OpenSettingsCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using Microsoft.VisualStudio.Shell; 4 | 5 | namespace WebAccessibilityChecker 6 | { 7 | internal sealed class OpenSettingsCommand 8 | { 9 | private readonly Package _package; 10 | 11 | private OpenSettingsCommand(Package package, OleMenuCommandService commandService) 12 | { 13 | _package = package; 14 | 15 | if (commandService != null) 16 | { 17 | var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.OpenSettings); 18 | var cmd = new OleMenuCommand(MenuItemCallback, id); 19 | commandService.AddCommand(cmd); 20 | } 21 | } 22 | 23 | public static OpenSettingsCommand Instance { get; private set; } 24 | 25 | private IServiceProvider ServiceProvider 26 | { 27 | get { return _package; } 28 | } 29 | 30 | public static void Initialize(Package package, OleMenuCommandService commandService) 31 | { 32 | Instance = new OpenSettingsCommand(package, commandService); 33 | } 34 | 35 | private void MenuItemCallback(object sender, EventArgs e) 36 | { 37 | _package.ShowOptionPage(typeof(Options)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Commands/RunNowCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using Microsoft.VisualStudio.Shell; 4 | 5 | namespace WebAccessibilityChecker 6 | { 7 | internal sealed class RunNowCommand 8 | { 9 | private readonly Package _package; 10 | 11 | private RunNowCommand(Package package, OleMenuCommandService commandService) 12 | { 13 | _package = package; 14 | 15 | if (commandService != null) 16 | { 17 | var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.RunNow); 18 | var cmd = new OleMenuCommand(MenuItemCallback, id); 19 | cmd.BeforeQueryStatus += BeforeQueryStatus; 20 | commandService.AddCommand(cmd); 21 | } 22 | } 23 | 24 | public static RunNowCommand Instance { get; private set; } 25 | 26 | private IServiceProvider ServiceProvider 27 | { 28 | get { return _package; } 29 | } 30 | 31 | public static void Initialize(Package package, OleMenuCommandService commandService) 32 | { 33 | Instance = new RunNowCommand(package, commandService); 34 | } 35 | 36 | private void BeforeQueryStatus(object sender, EventArgs e) 37 | { 38 | var button = (MenuCommand)sender; 39 | button.Enabled = CheckerExtension.Instance.HasConnections; 40 | } 41 | 42 | private void MenuItemCallback(object sender, EventArgs e) 43 | { 44 | TableDataSource.Instance.CleanAllErrors(); 45 | CheckerExtension.Instance.CheckA11y(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Commands/SpecifyRulesCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.IO; 4 | using System.Reflection; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace WebAccessibilityChecker 10 | { 11 | internal sealed class SpecifyRulesCommand 12 | { 13 | private readonly Package _package; 14 | private readonly DTE2 _dte; 15 | 16 | private SpecifyRulesCommand(Package package, OleMenuCommandService commandService) 17 | { 18 | _package = package; 19 | _dte = (DTE2)Package.GetGlobalService(typeof(DTE)); 20 | 21 | if (commandService != null) 22 | { 23 | var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.SpecifyRules); 24 | var cmd = new OleMenuCommand(MenuItemCallback, id); 25 | cmd.BeforeQueryStatus += BeforeQueryStatus; 26 | commandService.AddCommand(cmd); 27 | } 28 | } 29 | 30 | public static SpecifyRulesCommand Instance { get; private set; } 31 | 32 | private IServiceProvider ServiceProvider 33 | { 34 | get { return _package; } 35 | } 36 | 37 | public static void Initialize(Package package, OleMenuCommandService commandService) 38 | { 39 | Instance = new SpecifyRulesCommand(package, commandService); 40 | } 41 | 42 | private void BeforeQueryStatus(object sender, EventArgs e) 43 | { 44 | var button = (OleMenuCommand)sender; 45 | button.Enabled = false; 46 | 47 | if (_dte.Solution == null || string.IsNullOrEmpty(_dte.Solution.FullName)) 48 | return; 49 | 50 | string solDir = Path.GetDirectoryName(_dte.Solution.FullName); 51 | string destFile = Path.Combine(solDir, Constants.ConfigFileName); 52 | 53 | button.Enabled = !File.Exists(destFile); 54 | } 55 | 56 | private void MenuItemCallback(object sender, EventArgs e) 57 | { 58 | string solDir = Path.GetDirectoryName(_dte.Solution.FullName); 59 | string destFile = Path.Combine(solDir, Constants.ConfigFileName); 60 | 61 | string sourceFile = GetFileName("json\\schema\\" + Constants.ConfigFileName); 62 | File.Copy(sourceFile, destFile, true); 63 | 64 | AddFileToSolutionFolder(destFile, (Solution2)_dte.Solution); 65 | _dte.ItemOperations.OpenFile(destFile); 66 | 67 | Command command = _dte.Commands.Item("SolutionExplorer.SyncWithActiveDocument"); 68 | if (command.IsAvailable) 69 | { 70 | _dte.ExecuteCommand(command.Name); 71 | } 72 | } 73 | 74 | public static string GetFileName(string relativePath) 75 | { 76 | string assembly = Assembly.GetExecutingAssembly().Location; 77 | string folder = Path.GetDirectoryName(assembly); 78 | return Path.Combine(folder, relativePath); 79 | } 80 | 81 | public static void AddFileToSolutionFolder(string file, Solution2 solution) 82 | { 83 | Project currentProject = null; 84 | 85 | foreach (Project project in solution.Projects) 86 | { 87 | if (project.Kind == EnvDTE.Constants.vsProjectKindSolutionItems && project.Name == "Solution Items") 88 | { 89 | currentProject = project; 90 | break; 91 | } 92 | } 93 | 94 | if (currentProject == null) 95 | currentProject = solution.AddSolutionFolder("Solution Items"); 96 | 97 | currentProject.ProjectItems.AddFromFile(file); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/Commands/ToggleAutoRunCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using Microsoft.VisualStudio.Shell; 4 | 5 | namespace WebAccessibilityChecker 6 | { 7 | internal sealed class ToggleAutoRunCommand 8 | { 9 | private readonly Package _package; 10 | 11 | private ToggleAutoRunCommand(Package package, OleMenuCommandService commandService) 12 | { 13 | _package = package; 14 | 15 | if (commandService != null) 16 | { 17 | var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.EnableAccessibilityId); 18 | var cmd = new OleMenuCommand(MenuItemCallback, id); 19 | cmd.BeforeQueryStatus += BeforeQueryStatus; 20 | commandService.AddCommand(cmd); 21 | } 22 | } 23 | 24 | public static ToggleAutoRunCommand Instance { get; private set; } 25 | 26 | private IServiceProvider ServiceProvider 27 | { 28 | get { return _package; } 29 | } 30 | 31 | public static void Initialize(Package package, OleMenuCommandService commandService) 32 | { 33 | Instance = new ToggleAutoRunCommand(package, commandService); 34 | } 35 | 36 | private void BeforeQueryStatus(object sender, EventArgs e) 37 | { 38 | var button = (MenuCommand)sender; 39 | button.Checked = VSPackage.Options.RunOnPageLoad; 40 | } 41 | 42 | private void MenuItemCallback(object sender, EventArgs e) 43 | { 44 | var button = (MenuCommand)sender; 45 | 46 | VSPackage.Options.RunOnPageLoad = !button.Checked; 47 | VSPackage.Options.SaveSettingsToStorage(); 48 | 49 | if (!VSPackage.Options.RunOnPageLoad) 50 | { 51 | TableDataSource.Instance.CleanAllErrors(); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace WebAccessibilityChecker 2 | { 3 | class Constants 4 | { 5 | public const string ConfigFileName = ".a11yrc"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/ErrorList/AccessibilityResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using Newtonsoft.Json; 5 | 6 | namespace WebAccessibilityChecker 7 | { 8 | class AccessibilityResult 9 | { 10 | public string Url { get; set; } 11 | public string Project { get; set; } 12 | 13 | public IEnumerable Violations { get; set; } 14 | public IEnumerable Passes { get; set; } 15 | } 16 | 17 | class Rule 18 | { 19 | public string Description { get; set; } 20 | public string Help { get; set; } 21 | public string HelpUrl { get; set; } 22 | public string Html { get; set; } 23 | public string Id { get; set; } 24 | public string Impact { get; set; } 25 | public List Tags { get; set; } 26 | 27 | public __VSERRORCATEGORY GetSeverity() 28 | { 29 | switch (Impact) 30 | { 31 | case "critical": 32 | case "serious": 33 | return __VSERRORCATEGORY.EC_ERROR; 34 | 35 | case "moderate": 36 | return __VSERRORCATEGORY.EC_WARNING; 37 | } 38 | 39 | return __VSERRORCATEGORY.EC_MESSAGE; 40 | } 41 | 42 | private string _fileName; 43 | public string FileName 44 | { 45 | get { return _fileName; } 46 | set 47 | { 48 | _fileName = value; 49 | SetLineAndColumn(); 50 | } 51 | } 52 | 53 | private int _position = -1; 54 | public int Position 55 | { 56 | get { return _position; } 57 | set 58 | { 59 | _position = value; 60 | SetLineAndColumn(); 61 | } 62 | } 63 | 64 | [JsonIgnore] 65 | public int Line { get; set; } 66 | [JsonIgnore] 67 | public int Column { get; set; } 68 | 69 | private void SetLineAndColumn() 70 | { 71 | if (Line != 0 || Column != 0 || Position == -1 || string.IsNullOrEmpty(FileName) || !File.Exists(FileName)) 72 | return; 73 | 74 | int lineCount = 0; 75 | int columnCount = 0; 76 | int bufferPos = 0; 77 | bool hasBackslashN = false; 78 | 79 | using (var reader = new StreamReader(FileName)) 80 | { 81 | char[] buffer = new char[Position]; 82 | reader.ReadBlock(buffer, 0, Position); 83 | 84 | while (bufferPos < Position) 85 | { 86 | if (buffer[bufferPos] == '\r') 87 | { 88 | lineCount++; 89 | columnCount = 0; 90 | } 91 | else if (buffer[bufferPos] == '\n') 92 | { 93 | hasBackslashN = true; 94 | } 95 | 96 | columnCount++; 97 | bufferPos++; 98 | } 99 | } 100 | 101 | Line = lineCount; 102 | Column = columnCount - (hasBackslashN ? 1 : 0); 103 | } 104 | 105 | public override bool Equals(object obj) 106 | { 107 | var cast = obj as Rule; 108 | 109 | if (cast == null) 110 | return false; 111 | 112 | int thisHash = GetHashCode(); 113 | int objHash = cast.GetHashCode(); 114 | 115 | return thisHash.Equals(objHash); 116 | } 117 | 118 | public override int GetHashCode() 119 | { 120 | return $"{Id} {FileName} {Position}".GetHashCode(); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/ErrorList/ErrorListService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | 5 | namespace WebAccessibilityChecker 6 | { 7 | class ErrorListService 8 | { 9 | public static void ProcessLintingResults(AccessibilityResult result) 10 | { 11 | TableDataSource.Instance.CleanErrors(result.Url); 12 | 13 | if (!VSPackage.Options.ShowWarnings) 14 | { 15 | result.Violations = result.Violations.Where(r => r.GetSeverity() != __VSERRORCATEGORY.EC_WARNING); 16 | } 17 | 18 | if (!VSPackage.Options.ShowMessages) 19 | { 20 | result.Violations = result.Violations.Where(r => r.GetSeverity() != __VSERRORCATEGORY.EC_MESSAGE); 21 | } 22 | 23 | if (result.Violations.Any()) 24 | { 25 | TableDataSource.Instance.AddErrors(result); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ErrorList/SinkManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell.TableManager; 2 | using System.Linq; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace WebAccessibilityChecker 7 | { 8 | class SinkManager : IDisposable 9 | { 10 | private readonly ITableDataSink _sink; 11 | private TableDataSource _errorList; 12 | private List _snapshots = new List(); 13 | 14 | internal SinkManager(TableDataSource errorList, ITableDataSink sink) 15 | { 16 | _sink = sink; 17 | _errorList = errorList; 18 | 19 | errorList.AddSinkManager(this); 20 | } 21 | 22 | internal void Clear() 23 | { 24 | _sink.RemoveAllSnapshots(); 25 | } 26 | 27 | internal void UpdateSink(IEnumerable snapshots) 28 | { 29 | foreach (TableEntriesSnapshot snapshot in snapshots) 30 | { 31 | TableEntriesSnapshot existing = _snapshots.FirstOrDefault(s => s.Url == snapshot.Url); 32 | 33 | if (existing != null) 34 | { 35 | _snapshots.Remove(existing); 36 | _sink.ReplaceSnapshot(existing, snapshot); 37 | } 38 | else 39 | { 40 | _sink.AddSnapshot(snapshot); 41 | } 42 | 43 | _snapshots.Add(snapshot); 44 | } 45 | } 46 | 47 | internal void RemoveSnapshots(IEnumerable urls) 48 | { 49 | foreach (string url in urls) 50 | { 51 | TableEntriesSnapshot existing = _snapshots.FirstOrDefault(s => s.Url == url); 52 | 53 | if (existing != null) 54 | { 55 | _snapshots.Remove(existing); 56 | _sink.RemoveSnapshot(existing); 57 | } 58 | } 59 | } 60 | 61 | public void Dispose() 62 | { 63 | // Called when the person who subscribed to the data source disposes of the cookie (== this object) they were given. 64 | _errorList.RemoveSinkManager(this); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ErrorList/TableDataSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.Linq; 5 | using Microsoft.VisualStudio.ComponentModelHost; 6 | using Microsoft.VisualStudio.Shell; 7 | using Microsoft.VisualStudio.Shell.TableControl; 8 | using Microsoft.VisualStudio.Shell.TableManager; 9 | 10 | namespace WebAccessibilityChecker 11 | { 12 | class TableDataSource : ITableDataSource 13 | { 14 | private static TableDataSource _instance; 15 | private readonly List _managers = new List(); 16 | private static Dictionary _snapshots = new Dictionary(); 17 | 18 | [Import] 19 | private ITableManagerProvider TableManagerProvider { get; set; } = null; 20 | 21 | private TableDataSource() 22 | { 23 | var compositionService = ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel; 24 | compositionService.DefaultCompositionService.SatisfyImportsOnce(this); 25 | 26 | ITableManager manager = TableManagerProvider.GetTableManager(StandardTables.ErrorsTable); 27 | manager.AddSource(this, StandardTableColumnDefinitions.DetailsExpander, StandardTableColumnDefinitions.BuildTool, 28 | StandardTableColumnDefinitions.ErrorSeverity, StandardTableColumnDefinitions.ErrorCode, 29 | StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.ErrorCategory, 30 | StandardTableColumnDefinitions.Text, StandardTableColumnDefinitions.DocumentName, 31 | StandardTableColumnDefinitions.Line, StandardTableColumnDefinitions.Column); 32 | } 33 | 34 | public static TableDataSource Instance 35 | { 36 | get 37 | { 38 | if (_instance == null) 39 | _instance = new TableDataSource(); 40 | 41 | return _instance; 42 | } 43 | } 44 | 45 | public bool HasErrors 46 | { 47 | get { return _snapshots.Any(); } 48 | } 49 | 50 | #region ITableDataSource members 51 | public string SourceTypeIdentifier 52 | { 53 | get { return StandardTableDataSources.ErrorTableDataSource; } 54 | } 55 | 56 | public string Identifier 57 | { 58 | get { return PackageGuids.guidPackageString; } 59 | } 60 | 61 | public string DisplayName 62 | { 63 | get { return Vsix.Name; } 64 | } 65 | 66 | public IDisposable Subscribe(ITableDataSink sink) 67 | { 68 | return new SinkManager(this, sink); 69 | } 70 | #endregion 71 | 72 | public void AddSinkManager(SinkManager manager) 73 | { 74 | // This call can, in theory, happen from any thread so be appropriately thread safe. 75 | // In practice, it will probably be called only once from the UI thread (by the error list tool window). 76 | lock (_managers) 77 | { 78 | _managers.Add(manager); 79 | } 80 | } 81 | 82 | public void RemoveSinkManager(SinkManager manager) 83 | { 84 | // This call can, in theory, happen from any thread so be appropriately thread safe. 85 | // In practice, it will probably be called only once from the UI thread (by the error list tool window). 86 | lock (_managers) 87 | { 88 | _managers.Remove(manager); 89 | } 90 | } 91 | 92 | public void UpdateAllSinks() 93 | { 94 | lock (_managers) 95 | { 96 | foreach (SinkManager manager in _managers) 97 | { 98 | manager.UpdateSink(_snapshots.Values); 99 | } 100 | } 101 | } 102 | 103 | public void AddErrors(AccessibilityResult result) 104 | { 105 | if (result == null || !result.Violations.Any()) 106 | return; 107 | 108 | result.Violations = result.Violations.Where(v => !_snapshots.Any(s => s.Value.Errors.Contains(v))); 109 | 110 | var snapshot = new TableEntriesSnapshot(result); 111 | _snapshots[result.Url] = snapshot; 112 | 113 | UpdateAllSinks(); 114 | } 115 | 116 | public void CleanErrors(params string[] urls) 117 | { 118 | foreach (string url in urls) 119 | { 120 | if (_snapshots.ContainsKey(url)) 121 | { 122 | _snapshots[url].Dispose(); 123 | _snapshots.Remove(url); 124 | } 125 | } 126 | 127 | lock (_managers) 128 | { 129 | foreach (SinkManager manager in _managers) 130 | { 131 | manager.RemoveSnapshots(urls); 132 | } 133 | } 134 | 135 | UpdateAllSinks(); 136 | } 137 | 138 | public void CleanAllErrors() 139 | { 140 | foreach (string url in _snapshots.Keys) 141 | { 142 | TableEntriesSnapshot snapshot = _snapshots[url]; 143 | if (snapshot != null) 144 | { 145 | snapshot.Dispose(); 146 | } 147 | } 148 | 149 | _snapshots.Clear(); 150 | 151 | lock (_managers) 152 | { 153 | foreach (SinkManager manager in _managers) 154 | { 155 | manager.Clear(); 156 | } 157 | } 158 | 159 | UpdateAllSinks(); 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/ErrorList/TableEntriesSnapshot.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using EnvDTE80; 3 | using Microsoft.VisualStudio.Imaging; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.TableControl; 6 | using Microsoft.VisualStudio.Shell.TableManager; 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | namespace WebAccessibilityChecker 11 | { 12 | class TableEntriesSnapshot : WpfTableEntriesSnapshotBase 13 | { 14 | private string _projectName; 15 | private DTE2 _dte; 16 | 17 | internal TableEntriesSnapshot(AccessibilityResult result) 18 | { 19 | _dte = (DTE2)Package.GetGlobalService(typeof(DTE)); 20 | _projectName = result.Project; 21 | Errors.AddRange(result.Violations); 22 | Url = result.Url; 23 | } 24 | 25 | public List Errors { get; } = new List(); 26 | 27 | public override int VersionNumber { get; } = 1; 28 | 29 | public override int Count 30 | { 31 | get { return Errors.Count; } 32 | } 33 | 34 | public string Url { get; set; } 35 | 36 | public override bool TryGetValue(int index, string columnName, out object content) 37 | { 38 | content = null; 39 | 40 | if (index < 0 || index >= Errors.Count) 41 | { 42 | return false; 43 | } 44 | 45 | Rule error = Errors[index]; 46 | 47 | switch (columnName) 48 | { 49 | case StandardTableKeyNames.DocumentName: 50 | content = error.FileName; 51 | return true; 52 | case StandardTableKeyNames.ErrorCategory: 53 | content = vsTaskCategories.vsTaskCategoryMisc; 54 | return true; 55 | case StandardTableKeyNames.BuildTool: 56 | content = Vsix.Name; 57 | return true; 58 | case StandardTableKeyNames.Line: 59 | if (!string.IsNullOrEmpty(error.FileName)) 60 | { 61 | content = error.Line; 62 | return true; 63 | } 64 | return false; 65 | case StandardTableKeyNames.Column: 66 | if (!string.IsNullOrEmpty(error.FileName)) 67 | { 68 | content = error.Column; 69 | return true; 70 | } 71 | return false; 72 | case StandardTableKeyNames.Text: 73 | content = error.Description; 74 | return true; 75 | case StandardTableKeyNames.PriorityImage: 76 | case StandardTableKeyNames.ErrorSeverityImage: 77 | content = KnownMonikers.Accessibility; 78 | return true; 79 | case StandardTableKeyNames.ErrorSeverity: 80 | content = error.GetSeverity(); 81 | return true; 82 | case StandardTableKeyNames.Priority: 83 | content = vsTaskPriority.vsTaskPriorityMedium; 84 | return true; 85 | case StandardTableKeyNames.ErrorSource: 86 | content = ErrorSource.Other; 87 | return true; 88 | case StandardTableKeyNames.ErrorCode: 89 | content = error.Id; 90 | return true; 91 | case StandardTableKeyNames.ProjectName: 92 | content = _projectName; 93 | return true; 94 | case StandardTableKeyNames.ErrorCodeToolTip: 95 | content = error.Help; 96 | return true; 97 | case StandardTableKeyNames.HelpLink: 98 | content = Uri.EscapeUriString(error.HelpUrl); 99 | return true; 100 | default: 101 | content = null; 102 | return false; 103 | } 104 | } 105 | 106 | public override bool CanCreateDetailsContent(int index) 107 | { 108 | return !string.IsNullOrEmpty(Errors[index].Html); 109 | } 110 | 111 | public override bool TryCreateDetailsStringContent(int index, out string content) 112 | { 113 | Rule error = Errors[index]; 114 | content = $"Impact: {error.Impact}\r\nURL: {Url}\r\nHTML: {error.Html}"; 115 | return true; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/Helpers/DteHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using EnvDTE; 4 | 5 | namespace WebAccessibilityChecker 6 | { 7 | static class DteHelpers 8 | { 9 | public static string GetRootFolder(this Project project) 10 | { 11 | if (project == null || string.IsNullOrEmpty(project.FullName)) 12 | return null; 13 | 14 | string fullPath; 15 | 16 | try 17 | { 18 | fullPath = project.Properties.Item("FullPath").Value as string; 19 | } 20 | catch (ArgumentException) 21 | { 22 | try 23 | { 24 | // MFC projects don't have FullPath, and there seems to be no way to query existence 25 | fullPath = project.Properties.Item("ProjectDirectory").Value as string; 26 | } 27 | catch (ArgumentException) 28 | { 29 | // Installer projects have a ProjectPath. 30 | fullPath = project.Properties.Item("ProjectPath").Value as string; 31 | } 32 | } 33 | 34 | if (string.IsNullOrEmpty(fullPath)) 35 | return File.Exists(project.FullName) ? Path.GetDirectoryName(project.FullName) : null; 36 | 37 | if (Directory.Exists(fullPath)) 38 | return fullPath; 39 | 40 | if (File.Exists(fullPath)) 41 | return Path.GetDirectoryName(fullPath); 42 | 43 | return null; 44 | } 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Helpers/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | 6 | public static class Logger 7 | { 8 | static IVsOutputWindowPane pane; 9 | static object _syncRoot = new object(); 10 | static string _name; 11 | 12 | public static void Initialize(string name) 13 | { 14 | _name = name; 15 | } 16 | 17 | [SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsOutputWindowPane.OutputString(System.String)")] 18 | public static void Log(string message) 19 | { 20 | if (string.IsNullOrEmpty(message)) 21 | return; 22 | 23 | try 24 | { 25 | if (EnsurePane()) 26 | { 27 | pane.OutputString(DateTime.Now + ": " + message + Environment.NewLine); 28 | } 29 | } 30 | catch (Exception ex) 31 | { 32 | System.Diagnostics.Debug.Write(ex); 33 | } 34 | } 35 | 36 | public static void Log(Exception ex) 37 | { 38 | if (ex != null) 39 | { 40 | Log(ex.ToString()); 41 | } 42 | } 43 | 44 | static bool EnsurePane() 45 | { 46 | if (pane == null) 47 | { 48 | Guid guid = Guid.NewGuid(); 49 | var output = (IVsOutputWindow)Package.GetGlobalService(typeof(SVsOutputWindow)); 50 | output.CreatePane(ref guid, _name, 1, 1); 51 | output.GetPane(ref guid, out pane); 52 | } 53 | 54 | return pane != null; 55 | } 56 | } -------------------------------------------------------------------------------- /src/JSON/CreationListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using System.IO; 4 | using Microsoft.VisualStudio.Editor; 5 | using Microsoft.VisualStudio.Text; 6 | using Microsoft.VisualStudio.Text.Editor; 7 | using Microsoft.VisualStudio.TextManager.Interop; 8 | using Microsoft.VisualStudio.Utilities; 9 | 10 | namespace WebAccessibilityChecker 11 | { 12 | [Export(typeof(IVsTextViewCreationListener))] 13 | [ContentType("json")] 14 | [TextViewRole(PredefinedTextViewRoles.Document)] 15 | class CreationListener : IVsTextViewCreationListener 16 | { 17 | [Import] 18 | public IVsEditorAdaptersFactoryService EditorAdaptersFactoryService { get; set; } 19 | 20 | [Import] 21 | public ITextDocumentFactoryService TextDocumentFactoryService { get; set; } 22 | 23 | public void VsTextViewCreated(IVsTextView textViewAdapter) 24 | { 25 | IWpfTextView textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); 26 | ITextDocument document; 27 | 28 | if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document)) 29 | { 30 | string fileName = Path.GetFileName(document.FilePath); 31 | 32 | if (fileName.Equals(Constants.ConfigFileName, StringComparison.OrdinalIgnoreCase)) 33 | document.FileActionOccurred += DocumentSaved; 34 | } 35 | } 36 | 37 | private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e) 38 | { 39 | if (e.FileActionType == FileActionTypes.ContentSavedToDisk) 40 | { 41 | TableDataSource.Instance.CleanAllErrors(); 42 | CheckerExtension.Instance.CheckA11y(); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/JSON/Schema/.a11yrc: -------------------------------------------------------------------------------- 1 | { 2 | // See all rules at https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md 3 | "noscroll": true, 4 | "runOnly": { 5 | "type": "rule", 6 | 7 | "values": [ 8 | "accesskeys", 9 | "area-alt", 10 | "aria-allowed-attr", 11 | "aria-required-attr", 12 | "aria-required-children", 13 | "aria-required-parent", 14 | "aria-roles", 15 | "aria-valid-attr-value", 16 | "aria-valid-attr", 17 | "audio-caption", 18 | "blink", 19 | "button-name", 20 | "bypass", 21 | "checkboxgroup", 22 | "color-contrast", 23 | "definition-list", 24 | "dlitem", 25 | "document-title", 26 | "duplicate-id", 27 | "empty-heading", 28 | "frame-title", 29 | "heading-order", 30 | "html-has-lang", 31 | "html-lang-valid", 32 | "image-alt", 33 | "image-redundant-alt", 34 | "input-image-alt", 35 | "label-title-only", 36 | "label", 37 | "layout-table", 38 | "link-in-text-block", 39 | "link-name", 40 | "list", 41 | "listitem", 42 | "marquee", 43 | "meta-refresh", 44 | "meta-viewport-large", 45 | "meta-viewport", 46 | "object-alt", 47 | "radiogroup", 48 | //"region", 49 | "scope-attr-valid", 50 | "server-side-image-map", 51 | //"skip-link", 52 | "tabindex", 53 | "table-duplicate-name", 54 | "table-fake-caption", 55 | "td-has-header", 56 | "td-headers-attr", 57 | "th-has-data-cells", 58 | "valid-lang", 59 | "video-caption", 60 | "video-description" 61 | ] 62 | } 63 | } -------------------------------------------------------------------------------- /src/Options.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Microsoft.VisualStudio.Shell; 3 | 4 | namespace WebAccessibilityChecker 5 | { 6 | public class Options: DialogPage 7 | { 8 | [Category("General")] 9 | [DisplayName("Enabled")] 10 | [Description("Determines if the extension is enabled or not.")] 11 | [DefaultValue(true)] 12 | public bool Enabled { get; set; } = true; 13 | 14 | [Category("General")] 15 | [DisplayName("Run on page load")] 16 | [Description("Determines if the the accessiblity checker should run automatically on page load.")] 17 | [DefaultValue(true)] 18 | public bool RunOnPageLoad { get; set; } = true; 19 | 20 | [Category("Severity")] 21 | [DisplayName("Show warnings")] 22 | [Description("Shows accessibility errors classified as warnings.")] 23 | [DefaultValue(true)] 24 | public bool ShowWarnings { get; set; } = true; 25 | 26 | [Category("Severity")] 27 | [DisplayName("Show messages")] 28 | [Description("Shows accessibility errors classified as informational messages.")] 29 | [DefaultValue(false)] 30 | public bool ShowMessages { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using WebAccessibilityChecker; 4 | 5 | [assembly: AssemblyTitle(Vsix.Name)] 6 | [assembly: AssemblyDescription(Vsix.Description)] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany(Vsix.Author)] 9 | [assembly: AssemblyProduct(Vsix.Name)] 10 | [assembly: AssemblyCopyright(Vsix.Author)] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture(Vsix.Language)] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: AssemblyVersion(Vsix.Version)] 17 | [assembly: AssemblyFileVersion(Vsix.Version)] 18 | -------------------------------------------------------------------------------- /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/src/Resources/Icon.png -------------------------------------------------------------------------------- /src/Resources/Preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/src/Resources/Preview.png -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by Extensibility Tools v1.10.211 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace WebAccessibilityChecker 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string guidPackageString = "5123051b-3c1d-40e9-aedd-db11ee9f8b9a"; 16 | public const string guidPackageCmdSetString = "762f92d8-926a-4160-8519-badb7cc9a872"; 17 | public const string guidBrowserLinkCmdSetString = "30947ebe-9147-45f9-96cf-401bfc671a82"; 18 | public static Guid guidPackage = new Guid(guidPackageString); 19 | public static Guid guidPackageCmdSet = new Guid(guidPackageCmdSetString); 20 | public static Guid guidBrowserLinkCmdSet = new Guid(guidBrowserLinkCmdSetString); 21 | } 22 | /// 23 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 24 | /// 25 | internal sealed partial class PackageIds 26 | { 27 | public const int ErrorListGroup = 0x1000; 28 | public const int Menu = 0x2000; 29 | public const int MenuSubGroup = 0x3000; 30 | public const int MenuSettingsGroup = 0x4000; 31 | public const int EnableAccessibilityId = 0x0100; 32 | public const int ClearAllErrors = 0x0200; 33 | public const int SpecifyRules = 0x0300; 34 | public const int OpenSettings = 0x0400; 35 | public const int RunNow = 0x0500; 36 | public const int IDG_BROWSERLINK_COMMANDS = 0x2001; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Web Accessibility Checker 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 47 | 48 | 56 | 57 | 65 | 66 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/VSPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Runtime.InteropServices; 4 | using System.Threading; 5 | using Task = System.Threading.Tasks.Task; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace WebAccessibilityChecker 9 | { 10 | [Guid(PackageGuids.guidPackageString)] 11 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 12 | [InstalledProductRegistration("#110", "#112", Vsix.Version, IconResourceID = 400)] 13 | [ProvideMenuResource("Menus.ctmenu", 1)] 14 | [ProvideOptionPage(typeof(Options), "Web", "Accessibility Checker", 101, 111, true, new[] { "a11y", "wai", "section508", "wcag" }, ProvidesLocalizedCategoryName = false)] 15 | [ProvideAutoLoad(_activationContextGuid, PackageAutoLoadFlags.BackgroundLoad)] 16 | [ProvideUIContextRule(_activationContextGuid, "Load Package", 17 | "WAP | WebSite | ProjectK | DotNetCoreWeb", 18 | new string[] { 19 | "WAP", 20 | "WebSite", 21 | "ProjectK", 22 | "DotNetCoreWeb" 23 | }, 24 | new string[] { 25 | "SolutionHasProjectFlavor:{349C5851-65DF-11DA-9384-00065B846F21}", 26 | "SolutionHasProjectFlavor:{E24C65DC-7377-472B-9ABA-BC803B73C61A}", 27 | "SolutionHasProjectFlavor:{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}", 28 | "SolutionHasProjectCapability:DotNetCoreWeb" 29 | })] 30 | public sealed class VSPackage : AsyncPackage 31 | { 32 | private const string _activationContextGuid = "{d3114de0-d3b7-451e-b670-9a1740424cba}"; 33 | 34 | public static Options Options 35 | { 36 | get; 37 | private set; 38 | } 39 | 40 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 41 | { 42 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 43 | Logger.Initialize(Vsix.Name); 44 | 45 | Options = (Options)GetDialogPage(typeof(Options)); 46 | 47 | 48 | if (await GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService commandService) 49 | { 50 | ClearAllErrorsCommand.Initialize(this, commandService); 51 | ToggleAutoRunCommand.Initialize(this, commandService); 52 | OpenSettingsCommand.Initialize(this, commandService); 53 | RunNowCommand.Initialize(this, commandService); 54 | SpecifyRulesCommand.Initialize(this, commandService); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Web Accessibility Checker.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(VisualStudioVersion) 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | true 7 | 8 | 9 | 10 | Program 11 | $(DevEnvDir)\devenv.exe 12 | /rootsuffix Exp 13 | 14 | 15 | 16 | Debug 17 | AnyCPU 18 | 2.0 19 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 20 | {4DFEBB60-A06B-4DB4-B7B2-782761825FC7} 21 | Library 22 | Properties 23 | WebAccessibilityChecker 24 | WebAccessibilityChecker 25 | v4.6 26 | true 27 | true 28 | true 29 | true 30 | true 31 | false 32 | 33 | 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | pdbonly 44 | true 45 | bin\Release\ 46 | TRACE 47 | prompt 48 | 4 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Component 69 | 70 | 71 | source.extension.vsixmanifest 72 | 73 | 74 | True 75 | True 76 | VSCommandTable.vsct 77 | 78 | 79 | 80 | 81 | 82 | 83 | Resources\LICENSE 84 | true 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | true 93 | 94 | 95 | true 96 | 97 | 98 | true 99 | 100 | 101 | source.extension.vsixmanifest 102 | 103 | 104 | true 105 | 106 | 107 | Designer 108 | VsixManifestGenerator 109 | source.extension.resx 110 | 111 | 112 | 113 | 114 | False 115 | ..\lib\Microsoft.VisualStudio.Web.BrowserLink.12.0.dll 116 | False 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | Menus.ctmenu 128 | VsctGenerator 129 | VSCommandTable.cs 130 | 131 | 132 | 133 | 134 | True 135 | True 136 | source.extension.vsixmanifest 137 | true 138 | VSPackage 139 | 140 | 141 | 142 | 143 | 144 | 15.8.3247 145 | runtime; build; native; contentfiles; analyzers 146 | all 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 163 | -------------------------------------------------------------------------------- /src/icons.pkgdef: -------------------------------------------------------------------------------- 1 | [$RootKey$\ShellFileAssociations\.a11yrc] 2 | "DefaultIconMoniker"="KnownMonikers.ConfigurationFile" -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by Extensibility Tools v1.10.211 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace WebAccessibilityChecker 7 | { 8 | static class Vsix 9 | { 10 | public const string Id = "25a79d25-0fff-4748-afaa-3a67ed116bc9"; 11 | public const string Name = "Web Accessibility Checker"; 12 | public const string Description = @"The easiest way to perform accessibility checks on any ASP.NET web application. Fully customizable and support all the major international accessibility standards."; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.5"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "web, accessibility, a11y, wcag, section 508, wai, asp.net, axe"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/source.extension.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WebAccessibilityChecker/d8f1c7e623fdee669b2da7f841698a4e8839efaf/src/source.extension.ico -------------------------------------------------------------------------------- /src/source.extension.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Web Accessibility Checker 122 | 123 | 124 | The easiest way to perform accessibility checks on any ASP.NET web application. Fully customizable and support all the major international accessibility standards. 125 | 126 | 127 | 128 | source.extension.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Web Accessibility Checker 6 | The easiest way to perform accessibility checks on any ASP.NET web application. Fully customizable and support all the major international accessibility standards. 7 | https://github.com/madskristensen/WebAccessibilityChecker 8 | Resources\LICENSE 9 | https://github.com/madskristensen/WebAccessibilityChecker/blob/master/CHANGELOG.md 10 | Resources\Icon.png 11 | Resources\Preview.png 12 | web, accessibility, a11y, wcag, section 508, wai, asp.net, axe 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | --------------------------------------------------------------------------------