-
Notifications
You must be signed in to change notification settings - Fork 55
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
Feature/272 autocomplete upgrade #370
Open
tw2113
wants to merge
38
commits into
main
Choose a base branch
from
feature/272-autocomplete-upgrade
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sets. This will be used to load the js libraries instead of the current js folder.
… or modern, as well as if modern is chosen
…ent backcompat breaking
…ng it legacy and modern
…autocomplete is open
This PR needs this re-added somehow
|
Let's also look into adding any of the UX tracking/analytics/etc features that come with Autocomplete modern into the new template file, even if we have them commented out. Just placing things in the correct spot for users to see, would be a big step up for someone coming into the plugin, and wanting those features. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrade our available options for Algolia Autocomplete
With this feature, we will not be forcing everyone to upgrade their Autocomplete version, but we will start the process of offering the ability to.
Due to the detail that Algolia Autocomplete version 1.x and higher changes from listening to all specified form inputs, to requesting a dedicated div to render in, we can't blanket update everyone. Every user wanting to upgrade will need to amend their theme and website to have something like
<div id="autocomplete"></div>
or similar selector. This is where Algolia will render the autocomplete search field. The ID does not matter so much, as much as a valid selector in general. I have added filterability for this detail, as you'll see in the code.With this PR, to help with some separation, there is a new
assets
directory that stores the frontend assets for:Autocomplete.js 0.38.x will at present time be left in the original
js
location, as well as the other libraries. We can remove the duplicates from version control if really desired.Choosing Autocomplete version
There is a new setting on the "Autocomplete" settings page that lets users choose between "Legacy" aka our current 0.38.x version, or "Modern", which is presently at version 1.11.x. This option defaults to "Legacy" and upon admin loading, should populate the option with that default value, preventing accidental breaking changes.
What assets and template file(s) gets loaded depends on the selected setting.
Template changes
The plugin has a new
autocomplete-modern.php
file, as well as a newalgolia-autocomplete-modern.css
stylesheet file. The template file has been updated to match the structure and style that Autocomplete 1.11.x expects, and I aimed to replicate the look and feel of the dropdown as much as possible from our legacy. The stylesheet file is largely retained but the selectors are updated to match what comes in.Autocomplete config changes
I have gone ahead and added a new
input_selector_modern
property with its own WordPress filter for customization. It does default to'#autocomplete'
where that gets passed into the configuration object for Autocomplete in the template file.Let me know what your thoughts are, anything you would like changed, anything you think could be changed but needs further discussion, and whatnot.
Hopefully this pushes us over the proverbial edge to help our users start leveraging modern Autocomplete functionality, without having to leave them scratching their heads with a blank slate.