Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Autosuggest bugs #3110

Merged
merged 4 commits into from
Nov 7, 2022
Merged

Fix Autosuggest bugs #3110

merged 4 commits into from
Nov 7, 2022

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented Nov 4, 2022

Description of the Change

Fixes two Autosuggest issues.

  1. An issue where older Autosuggest filter functions were not automatically applies as hooks for backwards compatibility. This can happen if the filter function was defined after the backwards compatibility code is run. This fix defers the backwards compatibility code to run on the load event.
  2. An issue that prevented clicking Autosuggest suggestions if they had been customized with additional markup. The Autosuggest click listener did not work properly if elements were added inside the .autosuggest-link element, so this fix updates the event listener to work no matter how many child elements exist.

Closes #3095
Closes #3107

How to test the Change

  • Adding filters to Autosuggest using the <=4.3.0 method should work even if the filters are defined in a script that runs after ElasticPress' autosuggest.js.
  • Clicking Autosuggest suggestions should work as expected when filtering the item HTML with this HTML, and it should continue to work with the default HTML.

Changelog Entry

Fixed - An issue that caused Autosuggest filter functions to no longer work.
Fixed - An issue that prevented clicking Autosuggest suggestions if they had been customized with additional markup.

Credits

Props @JakePT

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@JakePT JakePT added the module:autosuggest Issues related to the Autosuggest functionality label Nov 4, 2022
@JakePT JakePT self-assigned this Nov 4, 2022
@JakePT JakePT added this to the 4.4.0 milestone Nov 4, 2022
@felipeelia felipeelia merged commit 693db77 into develop Nov 7, 2022
@felipeelia felipeelia deleted the fix/autosuggest branch November 7, 2022 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:autosuggest Issues related to the Autosuggest functionality
Projects
None yet
2 participants