Skip to content

Commit 14b149f

Browse files
authored
[A11y]Accessibility fixes 1 (#7927)
* Add aria-label for license text * Add more description aria-label for organization learn more. * add aria-live region to apikeys alert. * Roll back 7326 outline change. reintroduces 7305 as it is not actually a bug. * Correct role/reading of deprecation container. * Fix reading of alert on documentation edit. * Update delay for readme error diaply 100ms -> 0ms
1 parent b09e466 commit 14b149f

8 files changed

Lines changed: 21 additions & 17 deletions

File tree

src/Bootstrap/dist/css/bootstrap-theme.css

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/less/theme/page-display-package.less

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
justify-content: space-between;
3030
vertical-align: middle;
3131
width: 100%;
32-
outline: none;
3332

3433
.deprecation-expander-container {
3534
display: flex;
@@ -123,14 +122,14 @@
123122
font-size: 14px;
124123
color: #333333;
125124
margin: 4px 0 0 0;
126-
width: auto;
127-
overflow: hidden;
128-
text-overflow: ellipsis;
125+
width: auto;
126+
overflow: hidden;
127+
text-overflow: ellipsis;
129128
display: -webkit-box;
130129
line-height: 16px;
131-
/* fallback */
130+
/* fallback */
132131
max-height: 32px;
133-
/* fallback */
132+
/* fallback */
134133
-webkit-line-clamp: 2;
135134
/* number of lines to show */
136135
-webkit-box-orient: vertical;
@@ -141,7 +140,7 @@
141140
font-size: 16px;
142141
line-height: 19px;
143142
color: @brand-primary;
144-
width: auto;
143+
width: auto;
145144
}
146145

147146
.gh-star-count {
@@ -165,7 +164,7 @@
165164
.gh-empty-column {
166165
width: 15%;
167166
}
168-
167+
169168
.install-tabs {
170169
font-size: 0.8em;
171170

src/NuGetGallery/Scripts/gallery/page-edit-readme.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,13 @@ var BindReadMeDataManager = (function () {
340340
function displayReadMeError(errorMsg) {
341341
$("#readme-errors").removeClass("hidden");
342342
$("#preview-readme-button").attr("disabled", "disabled");
343-
$("#readme-error-content").text(errorMsg);
343+
344+
// This is required because in order for the screen reader to correctly read the message and alert
345+
// the message must change AFTER the element becomes visible. When we run all these commands
346+
// synchronously, it appears that the message content is changed BEFORE the element is finished rendering.
347+
// Delay it using a timeout so it will show after the message box is visible.
348+
setTimeout(() => { $("#readme-error-content").text(errorMsg); }, 0);
349+
344350
}
345351

346352
function clearReadMeError() {

src/NuGetGallery/Views/Organizations/Add.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="@ViewHelpers.GetColumnClasses(ViewBag)">
1818
@ViewHelpers.OrganizationsBreadcrumb(Url, CurrentUser, true, @<text>Add</text>)
1919
<p>
20-
Organizations allow you to manage and publish packages as a team or a group. <a href="https://go.microsoft.com/fwlink/?linkid=870439">Learn more.</a>
20+
Organizations allow you to manage and publish packages as a team or a group. <a href="https://go.microsoft.com/fwlink/?linkid=870439" aria-label="Learn more about organizations on NuGet.Org">Learn more.</a>
2121
</p>
2222
@if (errorMessage != null)
2323
{

src/NuGetGallery/Views/Packages/DisplayPackage.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159

160160
@switch (packageManager.AlertLevel)
161161
{
162-
case AlertLevel.Info:
162+
case AlertLevel.Info:
163163
@ViewHelpers.AlertInfo(
164164
@<text>
165165
@Html.Raw(packageManager.AlertMessage)
@@ -188,7 +188,7 @@
188188

189189
@* The following two helpers must be on a single line each so no extra whitespace is introduced in the expression when rendered. *@
190190
@* Helpers themselves are needed not to introduce that extra whitespce, which happens if they are inlined. *@
191-
@helper MakeLicenseLink(CompositeLicenseExpressionSegment segment) {<a href="@LicenseExpressionRedirectUrlHelper.GetLicenseExpressionRedirectUrl(segment.Value)">@segment.Value</a>}
191+
@helper MakeLicenseLink(CompositeLicenseExpressionSegment segment) {<a href="@LicenseExpressionRedirectUrlHelper.GetLicenseExpressionRedirectUrl(segment.Value)" aria-label="License @segment.Value">@segment.Value</a>}
192192
@helper MakeLicenseSpan(CompositeLicenseExpressionSegment segment) {<span>@segment.Value</span>}
193193

194194
<section role="main" class="container main-container page-package-details">

src/NuGetGallery/Views/Packages/_DisplayPackageDeprecation.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div class="deprecation-container">
44
<div class="icon-text alert alert-warning">
5-
<div id="show-deprecation-content-container" class="deprecation-expander" tabindex="0" data-toggle="collapse" data-target="#deprecation-content-container" aria-expanded="false" aria-controls="deprecation-content-container" aria-labelledby="deprecation-container-label">
5+
<div id="show-deprecation-content-container" class="deprecation-expander" tabindex="0" data-toggle="collapse" data-target="#deprecation-content-container" aria-expanded="false" aria-controls="deprecation-content-container" aria-labelledby="deprecation-container-label" role="button">
66
<div class="deprecation-expander" role="button">
77
<div class="deprecation-expander-container">
88
<i class="deprecation-expander-icon ms-Icon ms-Icon--Warning" aria-hidden="true"></i>

src/NuGetGallery/Views/Packages/_ImportReadMe.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
<div class="collapse in" id="readme-package-form">
2929

3030
<div id="readme-errors" class="hidden">
31-
<div class="alert alert-danger" role="alert" aria-live="assertive">
31+
<div class="alert alert-danger">
3232
<ul class="list-unstyled ms-Icon-ul">
3333
<li>
3434
<i class="ms-Icon ms-Icon--ErrorBadge" aria-hidden="true"></i>
35-
<span id="readme-error-content"></span>
35+
<span id="readme-error-content" role="alert" aria-live="assertive"></span>
3636
</li>
3737
</ul>
3838
</div>

src/NuGetGallery/Views/Users/ApiKeys.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
<b class="ms-fontSize-xl">Select Scopes</b>
335335
<br />
336336
<span class="has-error">
337-
<span class="help-block" data-bind="text: ScopesError"></span>
337+
<span class="help-block" data-bind="text: ScopesError" aria-live="polite" role="alert"></span>
338338
</span>
339339
<ul role="presentation">
340340
<li>

0 commit comments

Comments
 (0)