Javascript: 关闭Modal并且焦点不return到屏幕
Javascript: Close Modal and the focus not return to the screen
我正在通过 jQuery 使用模态对话框。当我关闭模式时,我无法按任何键(不是通过鼠标单击)。模态对话框的元素是否保持关闭的焦点事件。
<button class="btn" data-dismiss="modal" id="btn-cancel" aria-hidden="true">Cancel</button>
我刚刚创建了一个工作 example。
能否请您告诉我们您的代码与工作示例的不同之处?
或者 post 您的整个代码,这将非常有帮助。
我已经修好了。只需为隐藏模态时要触发的事件设置 setTimeOut。
$('#modalViewNode').on('hidden.bs.modal', function (e) {
setTimeout("$('.splittable-primary').focus();", 200);
});
我正在通过 jQuery 使用模态对话框。当我关闭模式时,我无法按任何键(不是通过鼠标单击)。模态对话框的元素是否保持关闭的焦点事件。
<button class="btn" data-dismiss="modal" id="btn-cancel" aria-hidden="true">Cancel</button>
我刚刚创建了一个工作 example。
能否请您告诉我们您的代码与工作示例的不同之处?
或者 post 您的整个代码,这将非常有帮助。
我已经修好了。只需为隐藏模态时要触发的事件设置 setTimeOut。
$('#modalViewNode').on('hidden.bs.modal', function (e) {
setTimeout("$('.splittable-primary').focus();", 200);
});