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

Autocomplete: reorganize modules and update to v2.1.8 #3064

Merged
merged 30 commits into from Jan 29, 2024

Conversation

crhallberg
Copy link
Contributor

@crhallberg crhallberg commented Aug 31, 2023

Separated from #2979.

TODO

themes/bootstrap3/js/common.js Outdated Show resolved Hide resolved
@demiankatz demiankatz added this to the 9.1 milestone Sep 5, 2023
@demiankatz
Copy link
Member

demiankatz commented Sep 7, 2023

@crhallberg, after looking at @ThoWagen's work on #2952, where he significantly refactored the search box reset button to incorporate it with his virtual keyboard support, I begin to wonder why we need to focus the search box in order to make the reset button work. I'm pretty sure it's that added focus call that introduced the problem that @EreMaijala first observed. It's entirely possible that the autocomplete improvements made here are worthwhile and helpful, but I wonder if we should also consider introducing a simplified version of searchbox_controls.js from #2952 into this PR (or a new PR) in order to begin taking advantage of that refactoring, which seems to keep things working while eliminating the extra focus call. What does everyone think? I'd also be interested to hear @xmorave2's opinion, since he might have more insight into whether the focus is needed for something I'm overlooking.

@crhallberg
Copy link
Contributor Author

@demiankatz I agree that would be easier, but my understanding was that the focusing is not to activate the clear button, but as an autofocus functionality. I’ll give it a second look though, you may be right.

@demiankatz
Copy link
Member

@crhallberg, I don't think autofocus was intended -- I believe we had previously discussed the negative accessibility implications of autofocus and decided against it, but I just let the change through without realizing the consequences.

@crhallberg
Copy link
Contributor Author

I think you were right about the autofocus. I've addressed it in the latest commit.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @crhallberg. There are a few issues noted below, but overall I think this is a step in the right direction! However, this also seems like more refactoring and changes than is strictly necessary to fix the problem at hand. I'm going to open a separate PR to just extract the bare minimum changes that I think are necessary to solve our issues in 9.1, and then we can target the rest of this to 10.0. Any objections?

themes/bootstrap3/js/common.js Show resolved Hide resolved
themes/bootstrap3/js/searchbox_controls.js Outdated Show resolved Hide resolved
themes/bootstrap3/js/searchbox_controls.js Outdated Show resolved Hide resolved
@demiankatz
Copy link
Member

Also, I'm encountering a test failure:

There was 1 failure:

1) VuFindTest\Mink\AutocompleteTest::testBasicAutocomplete
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/vufind_test/Search/Results?lookfor=Fake+DOI+test+1&type=AllFields'
+'http://localhost/vufind_test/Search/Results?lookfor=fake+doi+test&type=AllFields'

/usr/local/vufind/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AutocompleteTest.php:90
/usr/local/vufind/module/VuFind/src/VuFindTest/Feature/AutoRetryTrait.php:104

FAILURES!
Tests: 1, Assertions: 55, Failures: 1.

This test is passing on dev, so something has somehow gotten broken here.

@demiankatz demiankatz modified the milestones: 9.1, 10.0 Sep 8, 2023
@demiankatz
Copy link
Member

See #3080 for my simplified minimal fix. I have moved this PR's milestone to 10.0 -- we should revisit this after #3080 is merged and conflicts are resolved.

@demiankatz
Copy link
Member

Okay, now that #3080 is merged, we need to resolve conflicts here when time permits. For the moment, finishing up the 9.1-related pull requests is a higher priority, but hopefully we can clean this up early in the 10.0 development process.

@demiankatz
Copy link
Member

@crhallberg, can you take another look at this when time permits? Is it worth trying to resolve conflicts here, or have things moved so much that we're better off closing and taking a fresh approach? I honestly can't remember what we were trying to accomplish here (apart from fixing the bug cited in the description, which is already fixed now).

@crhallberg
Copy link
Contributor Author

I merged in dev but that caused some of the de-jQuery work to be reverted. We can address that after merge.

@demiankatz
Copy link
Member

Thanks, @crhallberg. It looks like there's some unaddressed feedback from a previous review, if you have a chance to look at that too. Also, I'm pretty sure this PR needs to be renamed, because the autocomplete opening problem was solved elsewhere. Is this applying more generalized fixes/improvements now?

@crhallberg crhallberg changed the title Fix autocomplete opening with autofocus Autocomplete: reorganize modules and update to v2.1.8. Nov 17, 2023
@crhallberg crhallberg changed the title Autocomplete: reorganize modules and update to v2.1.8. Autocomplete: reorganize modules and update to v2.1.8 Nov 17, 2023
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @crhallberg -- I think we're getting there, but if I'm remembering correctly how this works, there may still be some issues related to the virtual keyboard implementation.

themes/bootstrap3/js/searchbox_controls.js Show resolved Hide resolved
themes/bootstrap3/js/searchbox_controls.js Show resolved Hide resolved
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some recent fixes to the virtual keyboard have introduced conflicts here... and it's probably not worth trying to resolve them until after #3250 is finished as well. After that, we should make sure that all of those functional improvements are not lost in the refactoring here.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that #3250 has been merged, there are more conflicts to resolve. Can you sort it out when time permits, @crhallberg? Hopefully this gets the virtual keyboard logic into a stable place and we won't have to reconcile any further changes.

@crhallberg
Copy link
Contributor Author

crhallberg commented Dec 12, 2023

I've resolved the conflict but I'm seeing two issues that I'm investigating:

  • When I move the caret to the middle of the text, the virtual keyboard correctly inserts a few characters before jumping to the end.
  • When starting with a search and clicking the reset button, the keyboard appears but the text does not clear.

EDIT: I patched these errors but I'm unsure of the true cause. My top culprit is the virtual keyboard itself trying to sync the input based on the settings we're using.

@crhallberg
Copy link
Contributor Author

This is behaving all the ways I would expect - I cannot seem to break it. @ThoWagen, I would appreciate a look from you to double-check my refactoring. @sturkel89, if you have time, I wouldn't mind you trying to break it as well.

Thank you!

Copy link
Contributor

@ThoWagen ThoWagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides two small comments, I don't see any problems with this. I could not break the behavior as well. The virtual keyboard, the reset button and autocomplete are working well together.

The idea of _handleInputChange was to have one method that can handle all of the events and behavior independent of what caused the change. But I'm not convinced myself that this is a better approach than this.

config/vufind/searchbox.ini Outdated Show resolved Hide resolved
themes/bootstrap3/js/searchbox_controls.js Outdated Show resolved Hide resolved
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ThoWagen, I agree that these things need to be fixed.

@crhallberg, can you make the necessary adjustments and then request a review from @sturkel89 to get some final hands-on testing of everything?

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @crhallberg, I think this looks good now! All that's left to do is to mint the new release at the autocomplete.js repo and then update package.json here. Can you do that?

crhallberg added a commit to vufind-org/autocomplete.js that referenced this pull request Jan 29, 2024
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @crhallberg, looking good!

@demiankatz demiankatz dismissed EreMaijala’s stale review January 29, 2024 18:10

Feedback was addressed.

@demiankatz demiankatz merged commit e90154f into vufind-org:dev Jan 29, 2024
7 checks passed
@demiankatz demiankatz deleted the fix-ac-open branch January 29, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants