-
Notifications
You must be signed in to change notification settings - Fork 93
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 header bar search form #1354
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1354 +/- ##
============================================
+ Coverage 70.68% 71.92% +1.24%
- Complexity 1646 1831 +185
============================================
Files 32 32
Lines 3786 3961 +175
============================================
+ Hits 2676 2849 +173
- Misses 1110 1112 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I think I know why this happens. Selecting/deselecting options (vocabularies) from the multiselect widget triggers the onChange event, which again calls the updateVocabParam() function that sets the cookie: Skosmos/resource/js/docready.js Lines 998 to 1010 in 10d1595
But onChange is not triggered by the select all option. You need to define a separate onSelectAll event handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this and couldn't make it not work :) Looks good, apart from the issue that "select all" doesn't set the cookie, which you already noted. I suggested a fix in the above comment. It's also possible to consider that out of scope and file a separate issue about it.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The fix was a pretty simple one; removing the selected vocabularies and calling the updateVocabParam() function seemed to do the trick, as the empty selectedVocabs JS variable and no SKOSMOS_SELECTED value in the cookie is interpreted as having all the vocabularies chosen. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works perfectly! 🎉
Before merging, I suggest changing the PR title to something more descriptive. This fixes many problems related to global search, not just setting cookies.
Reasons for creating this PR
Cookies are not set correctly for things like multiple vocabulary selection in the global search field. This would break the global search UI element, restricting the use of global search to only skosmos API or writing the search parameters directly to the URL.
Link to relevant issue(s), if any
Description of the changes in this PR
Known problems or uncertainties in this PR
The search vocabulary parameter for "all vocabularies" is not set correctly in the cookie.
Checklist
.sr-only
class, color contrast)