typeahead: Don't hide typeahead on blur if focus is back in the input.

Now we don't hide the typeahead if the focus is back in the input within
150 ms. This is common when using the compose formatting buttons, which
only momentarily take the focus away from the input.

This is a prep commit for the next, to show typeahead on adding code
syntax with the code formatting button.
This commit is contained in:
N-Shar-ma 2024-03-07 23:08:44 +05:30 committed by Tim Abbott
parent fb25027cfb
commit 4f051d653c
1 changed files with 4 additions and 1 deletions

View File

@ -585,7 +585,10 @@ Typeahead.prototype = {
return;
}
setTimeout(() => {
if (!this.$container.is(":hover")) {
if (!this.$container.is(":hover") && !this.$element.is(":focus")) {
// We do not hide the typeahead in case it is being hovered over,
// or if the focus is immediately back in the input field (likely
// when using compose formatting buttons).
this.hide();
} else if (this.shown) {
// refocus the input if the user clicked on the typeahead