Git Product home page Git Product logo

Comments (5)

vladrusu avatar vladrusu commented on July 23, 2024 3

The bug manifests itself on both last step, but on first step also (clicking on Previous on the first step closes the tour but leaves the backdrop/highlighted element visible!).

Elaborating on @DancingDad's solution, I came with this code:

if (step.prev <= 0) {
	$prev.addClass('disabled').prop('disabled', true).prop('tabindex', -1);
	$prev.removeAttr('data-role');
}
if (step.next < 0) {
	$next.addClass('disabled').prop('disabled', true).prop('tabindex', -1);
	$next.removeAttr('data-role');
}

from bootstrap-tourist.

igor-stojcic avatar igor-stojcic commented on July 23, 2024 1

Regards to all. This is a great correction, I just think that in the first if statement step.prev <= 0 should only be step.prev < 0 . Correct me if I'm wrong. Thanks.

from bootstrap-tourist.

DancingDad avatar DancingDad commented on July 23, 2024

Think I found the issue.

Root Cause:
The data-role="next" is still in place, even though the button is visibly disabled. Due to the data-role being in place a click on the button still performs an action.

Fix:
In addition to adding the disabled class, added a line of code to remove the data-role attribute. This prevents the button from performing any action on click.

Code, recommended change shown with comment.

if (step.next < 0) {
    $next.addClass('disabled').prop('disabled', true).prop('tabindex', -1);
    $next.removeAttr('data-role');  // Added this line of code.
}

Testing:
After making the change locally:
All worked as expected:

  • Next button did not perform any action when on the last step.
  • Previous and End Tour buttons worked on last step.
  • Next button worked (obviously) on all earlier steps
  • Ran forward and back through the steps on multiple tours.
  • Ended and restarted the tour multiple times.

Leaving this issue open as I have not done a PR for this. Would classify myself as newbie at JS and some of this code looks a bit scary. :)

from bootstrap-tourist.

IGreatlyDislikeJavascript avatar IGreatlyDislikeJavascript commented on July 23, 2024

Thanks for finding and fixing this. I'm hoping to be in a position to start updating code again shortly, a full lockdown still exists in my country.

Due to the data-role being in place a click on the button still performs an action.

That's odd! I need to look into this, my expectation was that jq click event (and handler) wouldn't fire on a disabled element. Looks like you've tested your fix comprehensively too, thank you.

Would classify myself as newbie at JS and some of this code looks a bit scary. :)

Haha yes, you and me both. As I've said all along, I'm not a js coder! Some of the scary code is because the original developers wrote Tour in coffee script, which I've never heard of and since found out does some weird transpilation stuff, with no comments.

Thanks again.

from bootstrap-tourist.

AlexOulapourHCTX avatar AlexOulapourHCTX commented on July 23, 2024

Will killbobjr's fix for this be merged into master?

from bootstrap-tourist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.