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

Skip step for missing element #489

Open
lonix1 opened this issue May 2, 2024 · 2 comments
Open

Skip step for missing element #489

lonix1 opened this issue May 2, 2024 · 2 comments

Comments

@lonix1
Copy link

lonix1 commented May 2, 2024

(This is a question rather than bug report, as the repo doesn't have a "discussions" tab.)

New user here. I'm using the CDN script, on a server-rendered app.

Suppose my page does not contains some element. When that step is reached, a popup is shown in the middle of the screen, with the relevant text and buttons.

I'd like to skip that step.

I know of the "async actions" feature, but it doesn't apply here - I don't want to wait for that element to be created, rather, I want to skip that step.

Is that possible?

@Querela
Copy link

Querela commented Jun 7, 2024

Just saw this in another issue (#484). Filter steps that have valid selectors. But this doesn't account for elements that get removed over time as this would be done on initialization of the tour...

const filteredSteps: any = steps.filter(step => {
  const element = document.querySelector(step.element)
  return !step.element || element !== null
})

You could probably also check the onNextClick()/... handlers to check if the next/... N steps are possible otherwise skip them.

@lonix1
Copy link
Author

lonix1 commented Jun 7, 2024

Those are good workarounds to avoid the problem.

The best solution though is to have a built-in mechanism for this... something like "if selector is invalid, skip step". And configurable by an option of course.

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

No branches or pull requests

2 participants