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

DS-734: Add alumni events to federated search #936

Merged
merged 39 commits into from
Oct 30, 2024
Merged

Conversation

sherakama
Copy link
Member

@sherakama sherakama commented Aug 28, 2024

READY FOR REVIEW

Summary

  • Complete refactor of the Alumni search to utilize Instantsearch and more recent UI/UX patterns
  • Adds support for alumni events

Review By (Date)

  • End of the sprint

Criticality

  • Normal

Review Tasks

1. Test Modal Desktop

  1. Navigate to the home page of the preview build
  2. Click on the search icon in the masthead and ensure it opens an overlay
  3. Ensure overlay looks close to current production with the exception being the search field
  4. Ensure focus is on the search field
  5. click on the x to close the overlay
  6. ensure focus is on the search button in the masthead
  7. Hit enter to open the overlay again
  8. press esc to close the overlay
  9. Hit the space bar to open the overlay again
  10. Hit enter to search for an empty string
  11. Assert that you get the empty search message below the field
  12. Validate that the focus trap works by tab navigating through the overlay content until you get back to a focus on the search field
  13. Start typing goose or something else
  14. Use arrow keys to navigate autocomplete options
  15. Press esc to close autocomplete option
  16. Press down arrow to open autocomplete option
  17. Select an option and press enter
  18. Assert that the selected phrase is filled out in the search but you did not navigate to the search page yet
  19. Assert that the clear x option shows up in the search field
  20. Tab navigate to the clear option
  21. Press enter or space bar to clear search field
  22. Enter a new search phrase and select an option with the mouse
  23. Click on the Search icon
  24. Ensure you are navigated to /search with a ?q= parameter that matches your search string
  25. After page loads, click or tab to the search icon in the masthead
  26. Click or press the return key on the masthead search icon
  27. Assert that you scroll to the search field on the page and it is focused

2. Test Modal Mobile

  1. It is the same as desktop just squished so have a look and see that it works on your device.

3. Test Search Page

  1. Navigate to the search page with a query parameter and ensure the search field and state matches "Goose"
  2. Clear the search or start from a fresh page
  3. Click into or tab navigate to the search field
  4. Start typing a query
  5. Assert that the search autocomplete shows up
  6. Assert that you can click on an option and that the search happens right away
  7. Tab navigate and assert you are presented with a skip link past the filters to the results
  8. Select that and ensure the focus moves to the results
  9. Tab through the titles of the results
  10. Scroll back up and select one of the filters from the left sidebar
  11. Ensure the results are immediately updated
  12. Assert that the URL query strings have been updated to reflect your selection
  13. Copy and paste the URL into a new window and assert you get the same state after the page loads
  14. Close that new window
  15. Assert that the results get 'marked' with yellow highlights on the search keywords
  16. Select a couple more filters from the sidebar
  17. Ensure the order of the search items does not change but options without results are hidden
  18. Click on the reset all filters link and assert that the filters are removed
  19. Tab navigate or scroll down to the pager
  20. Select another page
  21. Assert when the page loads and you are scrolled back up to the results and that the URL has updated to show the search parameter
  22. Scroll back up and focus in the search field
  23. Clear the search field of any contents and hit return or click the search icon
  24. Ensure the no search text shows up below the search field
  25. Enter some garbage and search for something that shouldn't get any results
  26. Ensure the no results content shows up
  27. Clear search and start fresh
  28. Filter by Alumni Events
  29. Validate that only 'Events' show up in the results
  30. Validate that the event has the same date and location as found in the /events finder
  31. Search for Wine and ensure that you are shown the Stanford Wine Collection purple banner

4. Test Storyblok Configuration

  1. The search page is more or less the same as the Desktop version with the exception of the filters
  2. Validate the filters work and the clear and view buttons do what you expect them to

5. Aesthetic / A11y / Code

  1. Please also review for general looks and feels as well as any A11y concerns you have.
  2. Review code and catch all of my Shenanigans.

BUGS

  • Page gets dropped on deep link
  • Scroll to wrapper
  • Hash in URL causing navigation issues
  • Filter out previous events by date

@sherakama sherakama changed the title Preview search with events. DS-734: Add alumni events to federated search Sep 20, 2024
@sherakama
Copy link
Member Author

I'll look into the failing tests tomorrow.

@ericbakenhus
Copy link
Contributor

@sherakama Part 1 reviewed. Buttons are buttoning, modals are modaling, searches are searching, focus traps are trapping focus. 👍

One (very) subjective suggestion: when it auto scrolls to the search input on the search page it feels a little cramped at the top of the window. We could give it a little breathing room by tossing a top scroll margin on it.

No scroll margin:
Screenshot 2024-10-24 at 5 30 58 PM

With 50px top scroll margin:
Screenshot 2024-10-24 at 5 30 48 PM

@ericbakenhus
Copy link
Contributor

@sherakama Part 2: mobile seems good. 👍

@ericbakenhus
Copy link
Contributor

ericbakenhus commented Oct 25, 2024

@sherakama Part 3. Ran into a few issues. Everything not mentioned tested exactly as expected though. 👍

Issues found:

  • Seems like using the filter skip nav (i.e. adding a hash to the URL) triggers a new search/loading state.
  • If the URL has a hash in it (e.g. after using the skip filter nav), the clear search button doesn't reset the URL query or hash.
  • Bit an a11y/UX issue, selecting a filter makes the focus jump over to the wrapper element.
  • I'm not scrolled to the top after pagination (in FF). For the events search, I had to toss the scrolling code in a setTimeout to get it correctly queued up after the page change for events.
  • If I have an existing search (e.g. URL has q=test and results are showing for that search), but then manually clear the search input and hit enter/activate the search button then:
    • the "Uh oh..." message does appear, but
    • the"clear search" button also disappears, which makes clearing the existing search difficult.
  • I see an expired event in the results:

Screenshot 2024-10-25 at 11 58 01 AM

We're adding a date-based filter onto the events search to prevent that (I don't know if that can be easily applied here; I haven't looked at code yet). It should be less of an issue in production since the daily import function should be unpublishing/moving expired events.

  • I see an empty event. Don't know what's going on with that. 😅

Screenshot 2024-10-25 at 11 57 40 AM

Subjective thoughts:

  • Like before, maybe we could add some top scroll margin to the top of the results/wrapper/whatever it moves focus to (for when following the skip filters nav)
  • I really dislike using loading skeletons to show when Algolia is fetching an uncached query (searching on Directory gives me an aneurysm). The events search, for example, doesn't show any loading indicator (except if it hangs, then we toss on a 50% opacity and show a loading spinner). Even if it was slower (looking at you Coveo), I'd still heavily favor the opacity and/or spinner approach.
  • That wine banner is huge. More of a wine hero image/header. 😆

@sherakama
Copy link
Member Author

  • Seems like using the filter skip nav (i.e. adding a hash to the URL) triggers a new search/loading state.

Huh yeah, that's strange. I'll look into that.

  • If the URL has a hash in it (e.g. after using the skip filter nav), the clear search button doesn't reset the URL query or hash.

Thanks, I'll look into that.

  • Bit an a11y/UX issue, selecting a filter makes the focus jump over to the wrapper element.

I'll keep it on the filter.

  • I'm not scrolled to the top after pagination (in FF). For the events search, I had to toss the scrolling code in a setTimeout to get it correctly queued up after the page change for events.

Thanks, I'll see what I can do.

  • If I have an existing search (e.g. URL has q=test and results are showing for that search), but then manually clear the search input and hit enter/activate the search button then:
    • the "Uh oh..." message does appear, but
    • the"clear search" button also disappears, which makes clearing the existing search difficult.

Good catch

We're adding a date-based filter onto the events search to prevent (expired events)

That would be a good belt and suspenders thing to add.

  • I see an empty event. Don't know what's going on with that. 😅

I caught that too. Added some more validation in the middleware: https://github.com/SU-SWS/adapt-algolia-index/pull/120/commits/6fb73747a0e913f32ae4a14fbecfe22740eb1f3c

  • Like before, maybe we could add some top scroll margin to the top of the results/wrapper/whatever it moves focus to (for when following the skip filters nav)

The scroll kinda bugs me overall. Perhaps I just remove it.

  • I really dislike using loading skeletons to show when Algolia is fetching an uncached query (searching on Directory gives me an aneurysm). The events search, for example, doesn't show any loading indicator (except if it hangs, then we toss on a 50% opacity and show a loading spinner). Even if it was slower (looking at you Coveo), I'd still heavily favor the opacity and/or spinner approach.

Yeah, maybe I'll two step this. Opacity immediately, and skeles for hung.

  • That wine banner is huge. More of a wine hero image/header. 😆

Yuuuuuge

@@ -120,7 +120,7 @@ const EventDiscoveryContent = () => {
<Hits
hitComponent={Hit}
classNames={{
root: `${isStalled ? 'su-opacity-50' : ''}`,
root: `${isStalled ? 'su-opacity-30' : ''}`,
Copy link
Member Author

Choose a reason for hiding this comment

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

@ericbakenhus 50 didn't seem like enough on my monitor.


// Filter out any items we don't want to show.
const filteredItems = items.filter((item) => !excludes.includes(item.value));
// Sort the items alphabetically.
filteredItems.sort((a, b) => a.value.localeCompare(b.value));

// Show loading.
if (status === 'loading') {
if (isStalled) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Set the skeles to show when stalled (>2s)

Before that, the opacity is set to 30.

@@ -56,11 +56,12 @@ const SearchPage = (props) => {
<InstantSearch
searchClient={algoliaClient}
indexName={indexName}
stalledSearchDelay={3000}
stalledSearchDelay={2000}
Copy link
Member Author

Choose a reason for hiding this comment

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

Stall and show the skeles at 2s

@@ -20,13 +20,14 @@ const SearchField = ({ emptySearchMessage }) => {
const index = algoliaClient.initIndex(indexName);

// Hooks and state.
const { query, refine } = useSearchBox();
const { query, refine, clear } = useSearchBox();
Copy link
Member Author

Choose a reason for hiding this comment

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

Hey, would you look at that! A clear function. Might be a good fit for the clear link? 🤦

@@ -44,14 +45,27 @@ const SearchField = ({ emptySearchMessage }) => {
return;
}

// Add the filters to the autocomplete as well.
Copy link
Member Author

Choose a reason for hiding this comment

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

I've patched in the facets so that they filter the autocomplete results and don't show anything outside of what is available. Before this, if I filtered down and then used the autocomplete to select an item outside of the current filter range, I got a no results found message.

@@ -19,19 +19,19 @@ describe('Travel-Study Destinations Page', () => {
cy.wait(1000);

// Select Filter Month and check for URL update
cy.get('[data-test="filter-option--october"]').first().check({ force: true });
cy.url().should('contain', 'trip-month=oct');
cy.get('[data-test="filter-option--february"]').first().check({ force: true });
Copy link
Member Author

Choose a reason for hiding this comment

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

No upcoming october trips. 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if I've committed a crime here or not but this is helping the search page as the anchor links are triggering gatsby's (reach) router to do a 'navigate' and render. The change to the URL is also picked up by the history function in the instantsearch router.

By putting the path into the URL and omitting the default browser behaviour I skip the route page render but I am still getting the history event and the search still searches. At least with this code the search and facets still update the URL when they are interacted with.

Copy link
Contributor

Choose a reason for hiding this comment

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

It results in all the same expected behavior, so I'd say it's legal. 😆

@sherakama
Copy link
Member Author

@ericbakenhus and @yvonnetangsu I feel 'good enough' with this version. I've added a couple of follow-up tickets for the next sprint. Thanks for all of your review and feedback

DS-1027
DS-1028
DS-1029

@sherakama sherakama merged commit 6f3fe19 into dev Oct 30, 2024
6 checks passed
@sherakama sherakama deleted the DS-734/events-federated branch October 30, 2024 17:34
@sherakama
Copy link
Member Author

Ah shoot. Forgot to change the index back!

@sherakama sherakama mentioned this pull request Oct 30, 2024
sherakama added a commit that referenced this pull request Oct 30, 2024
* DS-734: Add alumni events to federated search (#936)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants