Skip to content

Commit

Permalink
Move default autosuggest selector definition so they can be filtered.…
Browse files Browse the repository at this point in the history
… Addresses #2168.
  • Loading branch information
JakePT committed Apr 21, 2021
1 parent b41bd2c commit 950a7cb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions assets/js/autosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,7 @@ function setFormIsLoading(isLoading, input) {
* init method called if the epas endpoint is defined
*/
function init() {
const epInputNodes = document.querySelectorAll(
`.ep-autosuggest, input[type="search"], .search-field, ${epas.selector}`,
);
const epInputNodes = document.querySelectorAll(`${epas.defaultSelectors}, ${epas.selector}`);

// build the container into which we place the search results.
// These will be cloned later for each instance
Expand Down
2 changes: 1 addition & 1 deletion dist/js/autosuggest-script.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions includes/classes/Feature/Autosuggest/Autosuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ public function enqueue_scripts() {
'placeholder' => $query['placeholder'],
'endpointUrl' => esc_url( untrailingslashit( $endpoint_url ) ),
'selector' => empty( $settings['autosuggest_selector'] ) ? 'ep-autosuggest' : esc_html( $settings['autosuggest_selector'] ),
'defaultSelectors' => '.ep-autosuggest, input[type="search"], .search-field',
'action' => 'navigate',
'mimeTypes' => [],
/**
Expand Down

0 comments on commit 950a7cb

Please sign in to comment.