Skip to content

Commit 77b7b1d

Browse files
authored
[A11y]Enable dismissing Verified tooltip with esc (#9074)
* Hide tooltip on esc when keyboard naving. * normalize keycode detection for browser compat.
1 parent 6ffe196 commit 77b7b1d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/NuGetGallery/Scripts/gallery/common.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,19 @@
468468
popoverElement.click(function () {
469469
popoverElement.popover('show');
470470
setTimeout(function () {
471-
popoverElement.popover('destroy');
471+
popoverElement.popover('hide');
472472
},
473473
2000);
474474
});
475+
popoverElement.keyup(function (event) {
476+
// normalize keycode for browser compatibility
477+
var code = event.which || event.keyCode || event.charCode;
478+
479+
// This is the keycode for the 'Esc' key
480+
if (code === 27) {
481+
popoverElement.popover('hide');
482+
}
483+
});
475484
};
476485

477486
window.nuget = nuget;

0 commit comments

Comments
 (0)