Fix modal deep-link not opening when CTA hash includes #_button-XX modifier#5993
Open
jsandland wants to merge 2 commits into
Open
Fix modal deep-link not opening when CTA hash includes #_button-XX modifier#5993jsandland wants to merge 2 commits into
jsandland wants to merge 2 commits into
Conversation
Modal init() runs before decorateButtons() strips style modifiers like #_button-fill from data-modal-hash, causing a hash mismatch against window.location.hash on direct/cross-page navigation.
Contributor
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modal.jsinit()is called beforedecorateButtons()indecorate.jsstrips#_button-fill(and similar style modifiers) fromdata-modal-hash#watch-videoin the URL,init()seesdata-modal-hash="#watch-video#_button-fill"and the comparisonwindow.location.hash !== modalHashfails — modal never opens on direct/cross-page navigationdecorateButtons()has already run andhrefis just#watch-video, triggering a cleanhashchangeFix
Normalize
modalHashininit()by stripping/#_button-[a-zA-Z-]+/gbefore comparing againstwindow.location.hash. This mirrors whatdecorateButtons()does later, without changing the decoration order.Test links
Bug (prod - modal does not open on direct hash navigation):
https://business.adobe.com/products/journey-optimizer.html#watch-video
Fixed (stage with Milo branch - modal opens on direct hash navigation):
https://stage--da-bacom--adobecom.aem.live/drafts/jsandlan/journey?milolibs=fix-modal-deep-link-button-hash#watch-video
Test plan
#watch-video- modal opens on load