Skip to content

Commit

Permalink
[a11y] Add popovers to verification checkmarks (#8521)
Browse files Browse the repository at this point in the history
Add popovers to verification checkmarks
  • Loading branch information
drewgillies committed Apr 16, 2021
1 parent ddfb02d commit 5cf5b9b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/NuGetGallery/App_Start/AppActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ private static void BundlingPostStart()
.Include("~/Scripts/gallery/clamp.js");
BundleTable.Bundles.Add(displayPackageScriptBundle);

var listPackagesScriptBundle = new ScriptBundle("~/Scripts/gallery/page-list-packages.min.js")
.Include("~/Scripts/gallery/page-list-packages.js");
BundleTable.Bundles.Add(listPackagesScriptBundle);

var managePackagesScriptBundle = new ScriptBundle("~/Scripts/gallery/page-manage-packages.min.js")
.Include("~/Scripts/gallery/page-manage-packages.js");
BundleTable.Bundles.Add(managePackagesScriptBundle);
Expand Down
1 change: 1 addition & 0 deletions src/NuGetGallery/NuGetGallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,7 @@
<Content Include="App_Data\Files\Content\Symbols-Configuration.json" />
<Content Include="Scripts\gallery\instrumentation.js" />
<Content Include="Scripts\gallery\knockout-3.5.1.js" />
<Content Include="Scripts\gallery\page-list-packages.js" />
<Content Include="Views\Shared\SiteMenu.cshtml">
<SubType>Code</SubType>
</Content>
Expand Down
17 changes: 17 additions & 0 deletions src/NuGetGallery/Scripts/gallery/page-list-packages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$(function() {
'use strict';

$(".reserved-indicator").each(
function() {
var checkmarkImage = $(this);
checkmarkImage.popover({ trigger: 'hover focus' });
checkmarkImage.click(function() {
checkmarkImage.popover('show');
setTimeout(function() {
checkmarkImage.popover('destroy');
},
1000);
});
}
);
});
2 changes: 2 additions & 0 deletions src/NuGetGallery/Views/Shared/ListPackages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,6 @@
location.href = '?q=@Uri.EscapeDataString(Model.SearchTerm)';
});
</script>
@Scripts.Render("~/Scripts/gallery/page-list-packages.min.js")
}
2 changes: 1 addition & 1 deletion src/NuGetGallery/Views/Shared/_ListPackage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<img class="reserved-indicator"
src="~/Content/gallery/img/reserved-indicator.svg"
@ViewHelpers.ImageFallback(Url.Absolute("~/Content/gallery/img/reserved-indicator-20x20.png"))
title="@Strings.ReservedNamespace_ReservedIndicatorTooltip" />
data-content="@Strings.ReservedNamespace_ReservedIndicatorTooltip" tabindex="0" />
}

@if (showEditButton && (Model.CanEdit || Model.CanManageOwners || Model.CanUnlistOrRelist))
Expand Down

0 comments on commit 5cf5b9b

Please sign in to comment.