Reputation: 1058
I'm using Angular-strap, auto-close directive close the popover when clicking outside of it, what about ESC button ? how can i close the popover when ESC button clicked from keyboard ?
Upvotes: 1
Views: 502
Reputation: 2416
Here's another SO question that's related to your question though it uses a jQuery approach which you may need to integrate into your app:
Close Bootstrap popover on esc keypress
Here's the demo: Plunker demo
Here's the jQuery approach:
$(document).keyup(function (event) {
if (event.which === 27) {
$('#example').popover('hide');
}
});
Upvotes: 1