Skip to content

fix: opening drill tour and responsive layout fixes#285

Open
mojoro wants to merge 5 commits intoCSSLab:mainfrom
mojoro:fix/drill-tour-and-ux
Open

fix: opening drill tour and responsive layout fixes#285
mojoro wants to merge 5 commits intoCSSLab:mainfrom
mojoro:fix/drill-tour-and-ux

Conversation

@mojoro
Copy link
Copy Markdown

@mojoro mojoro commented Mar 30, 2026

Summary

The opening drill tour (react-joyride) has several issues across mobile and desktop that prevent it from being as helpful as it could be on mobile and partially broken on desktop. The modal's responsive breakpoint also causes layout breakage at intermediate widths.

Issues fixed

  • Tour steps 2 & 3 target hidden/wrong elements: Step 2 targeted #opening-drill-selected which is inside a md:hidden wrapper on desktop and had duplicate IDs on mobile. Step 3 re-targeted the modal header (same as step 0) instead of a meaningful element.
  • No tab switching on mobile: On mobile, the drill modal uses tab navigation (Browse / Selected), but the tour didn't switch tabs before advancing to steps that reference content in the other tab.
  • Desktop layout breaks at intermediate widths: The two-column layout needs ~851px minimum, but the mobile tab layout didn't activate until md: (768px), causing the chessboard and preview panel to squeeze/overflow between 768-1024px.

Changes

src/constants/tours.ts

  • Convert openingDrillTourSteps from a static array to a function that returns mobile or desktop step configurations based on viewport width
  • Add beforeAction callbacks on mobile steps to dispatch synthetic click events on tab buttons, switching to the correct tab before Joyride targets the element
  • Fix tour targets: desktop step 3 → #opening-drill-preview, desktop step 4 → #opening-drill-queue, mobile step 4 → #opening-drill-selected-panel
  • Fix double-space typo in step description

src/contexts/TourContext.tsx

  • Add optional beforeAction callback to TourStep interface
  • Execute beforeAction in handleNext and handlePrevious before scroll/transition

src/components/Openings/OpeningSelectionModal.tsx

  • Bump layout-critical responsive breakpoints from md: to lg: (1024px) to match TABLET_BREAKPOINT_PX in WindowSizeContext
  • Rename SelectedPanel id from opening-drill-selected to opening-drill-selected-panel to resolve duplicate ID with the mobile tab button
  • Add id="opening-drill-queue" to Queue section for desktop tour targeting

Known issues (not addressed in this PR)

  • Desktop spotlight offset on step 4: The Joyride spotlight renders slightly above the target element on desktop when targeting elements inside nested scrollable containers. The tooltip positions correctly. disableScrollParentFix={false} fixes mobile but only improves desktop. I notice that on an actual phone, the current approach renders the spotlight position correctly. It is possibly a Joyride limitation with nested scroll parents, but I am not sure.
  • Duplicate opening-drill-browse IDs on mobile: The Browse tab button and BrowsePanel both have id="opening-drill-browse" on mobile. Pre-existing, not introduced by this PR.
  • openingDrillTourSteps() evaluated once at module load: The mobile/desktop decision is fixed for the session. If this needs to be reactive to resize, the call sites would need to invoke the function on each tour start.

Before (bugs)

Breakpoint: chessboard squeezed at intermediate width
Screenshot from 2026-03-30 14-10-36

Mobile step 4: spotlight the same as step 1, tooltip referencing a less helpful section of the drill panel
image

Desktop step 3: was targeting an id that didn't exist on desktop breakpoint, so the position got thrown off.
Screenshot from 2026-03-30 16-00-53

After (fixes)

Desktop tour:

Step 1
Screenshot from 2026-03-30 15-26-45

Step 2
Screenshot from 2026-03-30 15-26-52

Step 3
image

Step 4
Screenshot from 2026-03-30 15-34-02

Mobile tour:

Step 1
Screenshot from 2026-03-30 15-27-38

Step 2
Screenshot from 2026-03-30 15-27-55

Step 3 with working tab switch
Screenshot from 2026-03-30 15-27-59

Step 4
Screenshot from 2026-03-30 15-28-05

Test plan

  • Desktop: Open drill modal at >1024px, run through all 4 tour steps — verify spotlight and tooltip position correctly
  • Mobile: Open drill modal at <1024px, run through all 4 tour steps — verify tab switching works and spotlight targets correct elements
  • Intermediate width (768-1024px): Verify modal uses mobile tab layout instead of broken two-column layout
  • Previous/Back navigation: Verify going backwards through steps switches tabs correctly on mobile
  • Tour persistence: Verify completing or skipping the tour still saves to localStorage correctly
  • Other tours (analysis, play, puzzles, etc.): Verify they are unaffected by the beforeAction addition

mojoro added 5 commits March 30, 2026 15:07
…ased on viewport width

Converts the static openingDrillTourSteps array to a function that
returns mobile or desktop step configurations based on window width.
This allows different targetIds and placements per breakpoint without
changing the tourConfigs schema or any call sites.
Adds optional beforeAction callback to TourStep interface, executed
before each step transition in handleNext and handlePrevious. Used by
the opening drill tour to dispatch synthetic click events on mobile
tab buttons so the correct panel is visible before Joyride targets it.
- Add beforeAction to TourStep interface for pre-step DOM interactions
- Execute beforeAction in handleNext/handlePrevious before transitions
- Mobile step 2: dispatch click on Selected tab before targeting it
- Mobile step 3: dispatch click on Selected tab, target panel content
- Desktop step 3: target opening-drill-queue section
- Rename SelectedPanel id to opening-drill-selected-panel to avoid
  duplicate ids with the mobile tab button
- Add id to Queue section in DrillStudioPanel for desktop targeting
The two-column desktop layout (browse panel + preview) breaks at
widths below ~851px, but the mobile tab layout didn't activate until
md (768px). Bump layout-critical breakpoints to lg (1024px) to match
the existing TABLET_BREAKPOINT_PX used by WindowSizeContext.
- Extract clickTab helper to DRY up repeated dispatchEvent calls
- Fix off-by-one in isMobile check (<= 1024 -> < 1024) to match
  Tailwind lg: breakpoint (min-width: 1024px)
- Fix double space typo in step description
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

@mojoro is attempting to deploy a commit to the Maia Platform Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant