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

MWPW-151513: Search results vanished when user clicks on Marquee CTA:Start free trail #2406

Merged
merged 6 commits into from
Jul 11, 2024

Conversation

mirafedas
Copy link
Contributor

@mirafedas mirafedas commented Jun 3, 2024

When we search for some cards on the catalog page, for example, 'acrobat', the hash #search=acrobat gets added to the URL, and analogically for other filter params. When we open a modal in the marquee, we overwrite the hash value, and when we close the modal, the hash gets removed, so we lose the search results. To avoid this, before opening the modal, we remember the previous hash and restore it after it gets closed.

Related tacocat PR: https://git.corp.adobe.com/wcms/tacocat.js/pull/615 (the change from it is already included in /deps in this PR).

Resolves: MWPW-151513

Test URLs:
CC:

Milo:

@yesil
Copy link
Contributor

yesil commented Jun 3, 2024

@mirafedas thanks for the fix, can you add a unit test?

@@ -245,5 +250,8 @@ window.addEventListener('hashchange', (e) => {
} else {
const details = findDetails(window.location.hash, null);
if (details) getModal(details);
if (e.oldURL?.includes('#search=')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Milo should not be opinionated about the deep link values. So I don't expect to see search=.

Also, when I change the deeplink values by clicking on the category filters, they are not captured.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yesil thank you, I added a unit test and changed the condition, so now all filters get captured

@yesil
Copy link
Contributor

yesil commented Jun 3, 2024

@mirafedas this is good for a generic use case, but when we click on a modal link, the as the deeplink is lost, the page updates.
Ideally the deeplink logic in Tacocat should stop and keep the current state.
e.g:
hash changed and doesn't match with #a=b, deeplink stops and doesn't call listeners.
hash changes back to #a=b, deep link resumes.

cc: @Roycethan @afmicka

Copy link
Contributor

github-actions bot commented Jun 4, 2024

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@mirafedas mirafedas requested a review from a team as a code owner June 4, 2024 11:38
@mirafedas mirafedas force-pushed the MWPW-151513-search-results branch 2 times, most recently from 5e85fb0 to 9a48bce Compare June 4, 2024 19:37
@mirafedas
Copy link
Contributor Author

@yesil I added tacocat change in this PR: https://git.corp.adobe.com/wcms/tacocat.js/pull/615 , and included it in this PR

Copy link
Contributor

aem-code-sync bot commented Jun 5, 2024

Page Scores Audits Google
/drafts/mirafedas/all-modals?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@mirafedas mirafedas requested a review from yesil June 7, 2024 13:06
Copy link
Contributor

@yesil yesil left a comment

Choose a reason for hiding this comment

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

asked for a change in the related tacocat PR.

@mirafedas mirafedas force-pushed the MWPW-151513-search-results branch from a10931d to 636b39b Compare June 14, 2024 13:18
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.82%. Comparing base (a77e493) to head (38ebedf).

Additional details and impacted files
@@           Coverage Diff           @@
##            stage    #2406   +/-   ##
=======================================
  Coverage   95.82%   95.82%           
=======================================
  Files         175      175           
  Lines       45985    45993    +8     
=======================================
+ Hits        44064    44074   +10     
+ Misses       1921     1919    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mirafedas mirafedas requested a review from yesil June 14, 2024 13:57
@yesil
Copy link
Contributor

yesil commented Jun 18, 2024

@mirafedas the tacocat PR for merch-card-collection has been merged, please rebuild it from the develop branch and update here.

@mirafedas
Copy link
Contributor Author

@yesil thank you, I updated this PR, it's ready for review :)

@yesil
Copy link
Contributor

yesil commented Jun 28, 2024

@mirafedas you also need to ship sidenav in CC so that the search text doesn't vanish when you click the modal link.

@mirafedas
Copy link
Contributor Author

mirafedas commented Jun 28, 2024

@yesil I have a pending CC PR for updating sidenav, it's in the scope of a different task, but it will ship the latest sidenav to CC: adobecom/cc#335

Copy link
Contributor

github-actions bot commented Jul 6, 2024

This PR has not been updated recently and will be closed in 7 days if no action is taken. Please ensure all checks are passing, https://github.com/orgs/adobecom/discussions/997 provides instructions. If the PR is ready to be merged, please mark it with the "Ready for Stage" label.

@github-actions github-actions bot added the Stale label Jul 6, 2024
@@ -65,6 +66,10 @@ export function closeModal(modal) {
const hashId = window.location.hash.replace('#', '');
if (hashId === modal.id) window.history.pushState('', document.title, `${window.location.pathname}${window.location.search}`);
isDelayedModal = false;
if (prevHash) {
Copy link
Member

@Axelcureno Axelcureno Jul 9, 2024

Choose a reason for hiding this comment

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

How does this work? If prevHash is defined as empty string in L15, wouldn't this if always pass as true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We set the prevHash value on line 263 in the event listener which gets executed on the hash change. So when the closeModal function gets called, the prevHash may have a value

@github-actions github-actions bot removed the Stale label Jul 10, 2024
@afmicka afmicka added run-nala Run Nala Test Automation against PR verified PR has been E2E tested by a reviewer Ready for Stage labels Jul 10, 2024
@milo-pr-merge
Copy link
Contributor

milo-pr-merge bot commented Jul 10, 2024

Skipped merging 2406: MWPW-151513: Search results vanished when user clicks on Marquee CTA:Start free trail due to insufficient approvals. Required: 2 approvals

@milo-pr-merge milo-pr-merge bot merged commit c896518 into adobecom:stage Jul 11, 2024
23 of 24 checks passed
@milo-pr-merge milo-pr-merge bot mentioned this pull request Jul 11, 2024
rohitsahu pushed a commit to rohitsahu/milo that referenced this pull request Jul 16, 2024
* stage:
  Mwpw-142267:  Merch What's Included and Merch Mnemonic List (TwP) (adobecom#2554)
  MWPW-149124 Improve Focus Page for Performance Improvement Tiger Team  (adobecom#2391)
  Correctly send the created PR slacks (adobecom#2566)
  MWPW-153167: caas-config change to enable hiding date detail information (adobecom#2553)
  MWPW-152016 - Localization target preview for transcreation (adobecom#2564)
  Relax CORS restrictions for module imports (adobecom#2549)
  MWPW-153600 [PEP] loader bar on PEP prompt is seen loaded Left to right in RTL locale (adobecom#2548)
  MWPW-146962 [milo] Text link behaving like button in FAQ section (adobecom#2530)
  MWPW-152280 MEP: Only preload fragments that are in the 1st section (adobecom#2525)
  MWPW-152697 Fix Marketo mobile horizontal scroll (adobecom#2514)
  MWPW-151513: Search results vanished when user clicks on Marquee CTA:Start free trail (adobecom#2406)
  MWPW-154013 PEP prompt redirection is broken in stage after the PEP dismissal PR merge (adobecom#2547)
  MWPW-153962: Introduce maslibs query parameter (adobecom#2544)
  Central georouting support (adobecom#2531)
  [MWPW-152278] Avoid empty CSS requests (adobecom#2524)
  MWPW-152918 Fix Marketo button font (adobecom#2513)

# Conflicts:
#	libs/deps/merch-card.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Stage run-nala Run Nala Test Automation against PR verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants