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
[4.0] Fixing JS in com_finder #20888
Conversation
@Hackwar if you need to do changes on a vendor file you need to do them upstream! Also the package.json dependencies have a format Just do a |
package.json supports github repo links, which is what I did. I also did not modify the awesomplete files, but simply took the current head of their github repo. Considering that the last commit that I did to this PR is the result of |
👍 |
Now, just please solve the highlighting for non-ascii stuff. ;) |
Did that in #20571 😉 |
I have tested this item ✅ successfully on 011bbab This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20888. |
nice one!!! |
I have tested this item ✅ successfully on 011bbab This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20888. |
Ready to Commit after two successful tests. |
The JS in com_finder in 4.0 is very broken. There are several issues:
This PR fixes all of these things. I first updated the awesomplete suggestion script with the current head version from its repo (https://github.com/LeaVerou/awesomplete). The last release is from 2017 and we already have that in our codebase, which currently creates the focus errors.
I then created the awesomplete object just once and attached it to the input object, instead of creating it on each ajax call. Now we just update the list instead.
The event for the suggestions update is now upon "keyup", which then now takes the right string for the suggestions.
There is a bit of code that seems to be from a time where the placeholder attribute wasn't present. I removed that.
And last but not least, the error case for the ajax call first checks if there is any status code given. When we are just aborting the ajax call because we are submitting the form, then the status code is 0, otherwise it would be something like 200, 404 or 500.
Happy testing. Hope this makes you happy, @infograf768 and @carlitorweb 😉