Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accessibility issues identified by tool #5795

Merged
merged 12 commits into from
Apr 13, 2018
Merged

Conversation

scottbommarito
Copy link
Contributor

https://github.com/NuGet/Engineering/issues/1359

This PR fixes a number of small issues with the accessibility of our site as identified by a tool.
Mostly consists of changing roles and adding labels.

showErrors: function (errorMap, errorList) {
this.defaultShowErrors();

var i;
Copy link
Contributor Author

@scottbommarito scottbommarito Apr 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JQuery Validate adds an aria-describedby attribute to every validated field, even if the validation is successful. This is wrong because if there is no error, the aria-describedby leads to an empty element, which is invalid. This code removes the unnecessary attribute.

EDIT: going to put this in a comment for future's sake

.navbar-logo {
margin: 8px 20px 0 0;
}
.navbar-seperated .seperator {
.navbar-separated .seperator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the seperator as well, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently we don't even have a seperator, which means the entire navbar-separated class is useless

removed it entirely

@@ -50,10 +50,48 @@
} else {
error.insertAfter(element);
}
},
showErrors: function (errorMap, errorList) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jquery.validate calls it whenever the state of our forms has changed. It adds validation error text to our forms when the content isn't correct. I'm using their default process and appending an additional step.

});

if (ids.length) {
element.setAttribute("aria-describedby", ids.join(" "));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only call `setAttribute if the IDs set has changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setAttribute an expensive operation? I feel like the code is much simpler like this.

@@ -44,9 +44,9 @@
</div>
</div>
<div class="row text-center create-provider-account">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should only be one of these... not one per provider. You can put it in a Model.Providers.Count > 0 if depending on what @shishirx34 things.

@scottbommarito scottbommarito merged commit 2447f3a into dev Apr 13, 2018
@scottbommarito scottbommarito deleted the sb-kerosisangry branch April 13, 2018 21:19
@scottbommarito scottbommarito restored the sb-kerosisangry branch July 22, 2019 23:19
@scottbommarito scottbommarito deleted the sb-kerosisangry branch July 22, 2019 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants