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

stepIndex values differ between Windows and Apple-based devices at the end of the tour. #1746

Open
hiroshinishio opened this issue Aug 12, 2022 · 4 comments
Labels

Comments

@hiroshinishio
Copy link

Description

stepIndex values differ between Windows and Apple-based devices at the end of the tour. So I had to do this workaround.

  const onExit = async (stepIndex: number) => {
    // It should be compared to steps.length -1, but at least in Windows, there is a weird quirk in the way the library counts indexes, so when there are n steps, the index just before Exit is somehow n.
    // In iOS, like Mac PC, iPad, and iPhone, stepIndex will be 'n - 1'.
    if (stepIndex === steps.length || stepIndex === steps.length - 1) {
      setStepEnabled(false);
      // Process that counts once the tour is completed to the end.
      const newNumberOfTimesCompleted = numberOfTimesCompleted + 1;
      setNumberOfTimesCompleted(newNumberOfTimesCompleted);
      await handleSubmitProductTour(
        docId,
        productTourName,
        newNumberOfTimesCompleted
      );
    }
  };

To Reproduce

To reproduce, prepare a Windows PC and a Mac PC (or iPad or iPhone) and try console logging stepIndex in the onExit function.

I was able to notice this because my fellow developer and I were using different operating systems. I don't think I would have noticed otherwise.

Expected Behavior

I would like to see the same count for devices or rather operating systems.

Actual Behavior

stepIndex values differ between Windows and Apple-based devices at the end of the tour.

Errors and Screenshots (optional)

Example (recommended)

Environment (optional)

PC Spec

Device

  • Device name DESKTOP-608QNA0
  • Processor Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz 1.61 GHz
  • Installed RAM 16.0 GB (15.8 GB usable)
  • System type 64-bit operating system, x64-based processor
  • Pen and touch No pen or touch input is available for this display

OS

  • Edition Windows 10 Home
  • Version 21H2
  • Installed on ‎3/‎27/‎2021
  • OS build 19044.1826
  • Experience Windows Feature Experience Pack 120.2212.4180.0

Browser

  • Chrome Version 104.0.5112.81 (Official Build) (64-bit)

Mobile Spec

Device and OS

  • Software Version: 15.5
  • Model Name: iPhone 13 Pro

Browser

  • Chrome Version 103.0.5060.63
@hiroshinishio
Copy link
Author

hiroshinishio commented Aug 12, 2022

I don't know if it is because of Intro.js-react or Intro.js.
So created the same issue for Intro.js-react too.
HiDeoo/intro.js-react#88

@stale
Copy link

stale bot commented Oct 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 12, 2022
@hiroshinishio
Copy link
Author

Anybody?

@afshinm afshinm added bug and removed wontfix labels Oct 27, 2022
@afshinm
Copy link
Contributor

afshinm commented Oct 27, 2022

Are you using the same browser in Windows and Mac? Based on your description, I'm kinda surprised that the same browser is evaluate the code differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants