File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
build/media_source/com_finder/js Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 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' ) ) ;
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
You can’t perform that action at this time.
0 commit comments