Skip to content

Commit 9e10032

Browse files
authored
results on suggestion selection (#35521)
1 parent 6d96b63 commit 9e10032

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build/media_source/com_finder/js/finder.es6.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
}
5353
};
5454

55+
// Submits the form programmatically
56+
const submitForm = (event) => {
57+
const form = event.target.closest('form');
58+
if (form) {
59+
form.submit();
60+
}
61+
};
62+
5563
// The boot sequence
5664
const onBoot = () => {
5765
const searchWords = [].slice.call(document.querySelectorAll('.js-finder-search-query'));
@@ -63,6 +71,13 @@
6371

6472
// If the current value is empty, set the previous value.
6573
searchword.addEventListener('input', onInputChange);
74+
75+
const advanced = searchword.closest('form').querySelector('.js-finder-advanced');
76+
77+
// Do not submit the form on suggestion selection, in case of advanced form.
78+
if (!advanced) {
79+
searchword.addEventListener('awesomplete-selectcomplete', submitForm);
80+
}
6681
}
6782
});
6883

0 commit comments

Comments
 (0)