Skip to content

Commit e59a924

Browse files
authored
[A11y] Added column header roles, made each cell accessible with keyboard navigation (#9073)
1 parent 333ec36 commit e59a924

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/NuGetGallery/Views/Packages/DisplayPackage.cshtml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -732,15 +732,15 @@
732732
<table class="table borderless" aria-label="Packages that depend on @Model.Id">
733733
<thead>
734734
<tr>
735-
<th class="used-by-adjust-table-head" tabindex="0">Package</th>
736-
<th class="used-by-adjust-table-head" tabindex="0">Downloads</th>
735+
<th class="used-by-adjust-table-head" scope="col" role="columnheader" tabindex="0">Package</th>
736+
<th class="used-by-adjust-table-head" scope="col" role="columnheader" tabindex="0">Downloads</th>
737737
</tr>
738738
</thead>
739739
<tbody class="no-border">
740740
@foreach (var item in Model.PackageDependents.TopPackages)
741741
{
742742
<tr>
743-
<td class="used-by-desc-column">
743+
<td class="used-by-desc-column" tabindex="0">
744744
<a class="text-left ngp-link" href="@Url.Package(item.Id)">
745745
@(item.Id)
746746
</a>
@@ -754,7 +754,7 @@
754754
}
755755
<p class="used-by-desc">@item.Description</p>
756756
</td>
757-
<td>
757+
<td tabindex="0">
758758
<i class="ms-Icon ms-Icon--Download used-by-download-icon" aria-hidden="true"></i> <label class="used-by-count">@(item.DownloadCount.ToKiloFormat())</label>
759759
</td>
760760
</tr>
@@ -786,23 +786,23 @@
786786
<table class="table borderless" aria-label="GitHub repositories that depend on @Model.Id">
787787
<thead>
788788
<tr>
789-
<th class="used-by-adjust-table-head" tabindex="0">Repository</th>
790-
<th class="used-by-adjust-table-head" tabindex="0">Stars</th>
789+
<th class="used-by-adjust-table-head" scope="col" role="columnheader" tabindex="0">Repository</th>
790+
<th class="used-by-adjust-table-head" scope="col" role="columnheader" tabindex="0">Stars</th>
791791
</tr>
792792
</thead>
793793
<tbody class="no-border">
794794
@foreach (var item in Model.GitHubDependenciesInformation.Repos.Select((elem, i) => new { Value = elem, Idx = i }))
795795
{
796796
<tr>
797-
<td class="used-by-desc-column">
797+
<td class="used-by-desc-column" tabindex="0">
798798
<a data-index-number="@item.Idx" class="text-left gh-link" href="@item.Value.Url" target="_blank">
799799
@(item.Value.Id)
800800
</a>
801801
<div class="row used-by-desc">
802802
<span>@(item.Value.Description)</span>
803803
</div>
804804
</td>
805-
<td>
805+
<td tabindex="0">
806806
<i class="ms-Icon ms-Icon--FavoriteStarFill gh-star" aria-hidden="true"></i> <label class="used-by-count">@(item.Value.Stars.ToKiloFormat())</label>
807807
</td>
808808
</tr>
@@ -829,20 +829,20 @@
829829
<table aria-label="Version History of @Model.Id" class="table borderless">
830830
<thead>
831831
<tr>
832-
<th scope="col" tabindex="0">Version</th>
833-
<th scope="col" tabindex="0">Downloads</th>
834-
<th scope="col" tabindex="0">Last updated</th>
832+
<th scope="col" role="columnheader" tabindex="0">Version</th>
833+
<th scope="col" role="columnheader" tabindex="0">Downloads</th>
834+
<th scope="col" role="columnheader" tabindex="0">Last updated</th>
835835
@if (Model.CanDisplayPrivateMetadata)
836836
{
837-
<th scope="col" tabindex="0">Status</th>
837+
<th scope="col" role="columnheader" tabindex="0">Status</th>
838838
}
839839
@if (Model.IsCertificatesUIEnabled)
840840
{
841-
<th scope="col" aria-hidden="true" abbr="Signature Information"></th>
841+
<th scope="col" role="columnheader" aria-hidden="true" abbr="Signature Information"></th>
842842
}
843843
@if (Model.IsPackageDeprecationEnabled || Model.IsPackageVulnerabilitiesEnabled)
844844
{
845-
<th scope="col" aria-hidden="true" abbr="Package Warnings"></th>
845+
<th scope="col" role="columnheader" aria-hidden="true" abbr="Package Warnings"></th>
846846
}
847847
</tr>
848848
</thead>
@@ -853,7 +853,7 @@
853853
|| (!packageVersion.Deleted && Model.CanDisplayPrivateMetadata))
854854
{
855855
<tr class="@(packageVersion.IsCurrent(Model) ? "bg-info" : null)">
856-
<td>
856+
<td tabindex="0">
857857
<a href="@Url.Package(packageVersion)" title="@packageVersion.Version">
858858
@packageVersion.Version.Abbreviate(30)
859859
</a>

0 commit comments

Comments
 (0)