Skip to content

Commit 20a44a5

Browse files
[chores] Added escape key handler for object notification widget #133
Closes #133
1 parent c110d41 commit 20a44a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

openwisp_notifications/static/openwisp-notifications/js/object-notifications.js

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ function initObjectNotificationDropdown($) {
5252
$('.ow-object-notification-option-container').addClass('ow-hide');
5353
}
5454
});
55+
$('.ow-object-notification-option-container').on('keyup', '*', function(e){
56+
e.stopPropagation();
57+
// Hide dropdown on "Escape" key
58+
if (e.keyCode == 27){
59+
$('.ow-object-notification-option-container').addClass('ow-hide');
60+
$('#ow-object-notify').focus();
61+
}
62+
});
5563
}
5664

5765
function addObjectNotificationHandlers($) {

0 commit comments

Comments
 (0)