Blur the active element on settings/streams modal exit.

This blurs any focused element so that you can’t accidentally enter
into anything on a hidden modal.
This commit is contained in:
Brock Whittaker 2016-12-14 14:25:49 -08:00 committed by Tim Abbott
parent af857d883b
commit 660144a79d
2 changed files with 6 additions and 0 deletions

View File

@ -248,6 +248,7 @@ exports.initialize = function () {
exports.exit_settings = function (callback) {
if (should_ignore(window.location.hash)) {
ui.blur_active_element();
ignore.flag = true;
window.location.hash = ignore.prev || "#";
if (typeof callback === "function") {

View File

@ -35,6 +35,11 @@ exports.focus_on = function (field_id) {
$("#" + field_id).focus();
};
exports.blur_active_element = function () {
// this blurs anything that may perhaps be actively focused on.
document.activeElement.blur();
};
function amount_to_paginate() {
// Some day we might have separate versions of this function
// for Page Up vs. Page Down, but for now it's the same