I am using Twitter Bootstrap for modal dialogs: http://twitter.github.com/bootstrap/javascript.html#modals (bootstrap-modal.js).
When I hit "esc", the modal closes, as expected. However, as you can see from the example on that page, the cursor is then missing. The user has to click on the browser window to put it back in focus.
This is an issue for me, because I have a site that's primarily driven by keyboard shortcuts. As a result, once the modal dialog is closed, the user will hit a certain keys expecting something to happen, but it won't work. He/she first will have to click in the browser window for the keyboard shortcuts to work again.
I've tried calling $('body').focus()
after the modal is hidden (i.e. after $('#modalDiv').modal('hide');
, but that does not change anything.
Any ideas?