Commit e9f806db authored by Robert Lyon's avatar Robert Lyon

Bug 1568619: Allowing openbadge info modal to open via enter key

Also allow one to tab through the modal and close it and put the focus
back on the badge we used to open the modal

behatnotneeded

Change-Id: I45c428f7abfa6e20be3b1a6d0c6867ec6f62f199
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 4e75d877
......@@ -186,7 +186,7 @@ class PluginBlocktypeOpenbadgedisplayer extends SystemBlocktype {
continue;
}
$html .= '<img '
$html .= '<img tabindex="0" id="' . (preg_replace('/\:/', '_', $group)) . '" '
. 'src="' . $b->image . '" '
. 'title="' . $b->name . '" '
. 'data-assertion="' . htmlentities(json_encode($badge->assertion)) . '" />';
......
......@@ -6,6 +6,14 @@
$('#openbadges{{$id}}').on('click', 'img', function () {
showBadgeContent({html: buildBadgeContent($(this).data('assertion'))});
});
$('#openbadges{{$id}}').on('keypress', 'img', function (event) {
if (event.keyCode == 13) {
showBadgeContent({html: buildBadgeContent($(this).data('assertion'))});
$('#badge-content-dialog').on("hidden.bs.modal", function () {
$('#' + $(event.target).attr('id')).focus();
});
}
});
});
})(jQuery);
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment