open recent notes autocomplete by focus so it is then closed with blur, fixes #272

This commit is contained in:
azivner 2019-01-10 21:04:06 +01:00
parent f5b933149a
commit 0b251530fa
3 changed files with 9 additions and 5 deletions

View File

@ -6,8 +6,6 @@ const $dialog = $("#jump-to-note-dialog");
const $autoComplete = $("#jump-to-note-autocomplete"); const $autoComplete = $("#jump-to-note-autocomplete");
const $showInFullTextButton = $("#show-in-full-text-button"); const $showInFullTextButton = $("#show-in-full-text-button");
$dialog.on("shown.bs.modal", e => $autoComplete.focus());
async function showDialog() { async function showDialog() {
glob.activeDialog = $dialog; glob.activeDialog = $dialog;

View File

@ -28,7 +28,7 @@ function clearText($el) {
function showRecentNotes($el) { function showRecentNotes($el) {
$el.setSelectedPath(""); $el.setSelectedPath("");
$el.autocomplete("val", ""); $el.autocomplete("val", "");
$el.autocomplete("open"); $el.focus();
} }
function initNoteAutocomplete($el, options) { function initNoteAutocomplete($el, options) {
@ -61,7 +61,13 @@ function initNoteAutocomplete($el, options) {
$clearTextButton.click(() => clearText($el)); $clearTextButton.click(() => clearText($el));
$showRecentNotesButton.click(() => showRecentNotes($el)); $showRecentNotesButton.click(e => {
showRecentNotes($el);
// this will cause the click not give focus to the "show recent notes" button
// this is important because otherwise input will lose focus immediatelly and not show the results
return false;
});
$goToSelectedNoteButton.click(() => { $goToSelectedNoteButton.click(() => {
if ($el.hasClass("disabled")) { if ($el.hasClass("disabled")) {

View File

@ -87,7 +87,7 @@ $searchInput.keyup(e => {
if (e && e.which === $.ui.keyCode.ENTER) { if (e && e.which === $.ui.keyCode.ENTER) {
doSearch(); doSearch();
} }
}).focus(); });
$doSearchButton.click(() => doSearch()); // keep long form because of argument $doSearchButton.click(() => doSearch()); // keep long form because of argument
$resetSearchButton.click(resetSearch); $resetSearchButton.click(resetSearch);