typeahead: Hide typeahead on clicking outside after clicking its header.

Until now, the typeahead was hidden on clicking outside only if the last
click was not on the header. This happened because clicking the header would
blur the input, and any other click then would not trigger the blur event
(which is responsible for hiding the typeahead).

Now we refocus the input after clicking the header, so that clicking
elsewhere blurs the input and hides the typeahead.
This commit is contained in:
N-Shar-ma 2023-03-31 19:51:27 +05:30 committed by Tim Abbott
parent 449febf036
commit f1ec9e139f
1 changed files with 5 additions and 0 deletions

View File

@ -495,6 +495,11 @@ import {get_string_diff} from "../../src/util";
setTimeout(function () {
if (!that.$container.is(':hover')) {
that.hide();
} else if (that.shown) {
// refocus the input if the user clicked on the typeahead
// so that clicking elsewhere registers as a blur and hides
// the typeahead.
that.$element.focus();
}
}, 150)
}