Bootstrap provides us with many convenient page controls, modal is one of them. Many people have encountered the problem that modal cannot be closed by pressing the esc key, and it does not take effect even if the keyboard option is explicitly passed in.
$('#editFormItemModal').modal({show:true, keyboard:true});
This problem occurs in versions 2.1 and later. It is very simple to solve this problem. Just add a tabindex attribute to the div where the modal is located:
The problem is very simple and the fix is also very simple. I hope it can be helpful to everyone.