Modify when to cancel tours#73655
Open
kobryan0619 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Shepherd-based onboarding tours on the Teacher Homepage (v2) to avoid overlapping tours during SPA navigation, cancel tours when their anchors disappear, and refine onboarding tip styling.
Changes:
- Cancel any existing
Shepherd.activeTourbefore creating/resuming a tour to prevent overlapping popovers. - Add DOM-removal cancellation via
MutationObserver(both for step anchors and for the “Add Section” dialog dismissal case). - Update onboarding step container styles and add/extend unit tests for the new cancellation behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/src/templates/studioHomepages/teacherHomepageV2/useReviewSyllabusTour.ts | Cancels any active tour before resuming; memoizes step builder via useCallback. |
| apps/src/templates/studioHomepages/teacherHomepageV2/useLearnHowToEvaluateTour.ts | Cancels any active tour before resuming; memoizes step builder via useCallback. |
| apps/src/templates/studioHomepages/teacherHomepageV2/useCreateSectionTour.ts | Cancels any active tour before resuming; memoizes step builder via useCallback. |
| apps/src/templates/studioHomepages/teacherHomepageV2/createSectionOnboarding.ts | Cancels the tour if the Add Section dialog closes without a login type selection (MutationObserver-based). |
| apps/src/sharedComponents/productTour/shepherdTourFactory.ts | Adds anchor-watching MutationObserver to cancel tour when the attachTo anchor is removed; disconnects observer on hide/complete/cancel. |
| apps/src/sharedComponents/productTour/shepherd.scss | Updates onboarding tip box padding/layout and removes quiz feedback min-height. |
| apps/test/unit/templates/studioHomepages/teacherHomepageV2/useReviewSyllabusTourTest.ts | Adds coverage for canceling an active Shepherd tour before resuming. |
| apps/test/unit/templates/studioHomepages/teacherHomepageV2/useLearnHowToEvaluateTourTest.ts | Adds coverage for canceling an active Shepherd tour before resuming. |
| apps/test/unit/templates/studioHomepages/teacherHomepageV2/useCreateSectionTourTest.ts | Adds/extends tests for resuming behavior, active-tour cancellation, and completion/cancel side effects. |
| apps/test/unit/templates/studioHomepages/teacherHomepageV2/createSectionOnboardingTest.ts | Adds tests for dialog-dismissal cancellation behavior. |
| apps/test/unit/sharedComponents/productTour/shepherdTourFactoryTest.ts | New unit tests validating anchor-removal cancellation and observer cleanup behavior. |
Comment on lines
52
to
56
| // Resume at the saved step if it belongs to this page, otherwise start | ||
| // at the first step (the saved step was from the previous page). | ||
| const startStep = tour.steps.find(s => s.id === savedStepId) ?? tour.steps[0]; | ||
| tour.show(startStep.id); | ||
| }; |
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.
This PR:
NEW:

OLD:

It does not do:
Links
Testing story
Deployment notes
Privacy and security