Problem/Motivation

With Drupal ~11.2.0

An uncaught JavaScript TypeError is thrown in the Tour module when currentStep is undefined during Shepherd's show() or cancel callbacks. The error prevents the tour from properly ending and disrupts the user experience.

Steps to reproduce

  • Start a tour.
  • Navigate through steps.
  • When a tour ends or is canceled, it does not exit cleanly and throws a JS error.

Proposed resolution

  • Add safety checks before accessing currentStep.el.querySelector(...) to ensure currentStep and el exist and .focus() is callable.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork tour-3535035

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes

rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

StatusFileSize
new108.79 KB

Attached a static tour--2025-07-10--3535035--mr-103.patch file, for this point of MR103.
To be used with Composer Patches.

smustgrave’s picture

tested this in 11.2 but not getting any error

smustgrave’s picture

Status: Needs review » Fixed

Found 2 issues reporting so I'll merge

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.