Comments (5)
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.
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.
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.
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.
Will killbobjr's fix for this be merged into master?
from bootstrap-tourist.
Related Issues (20)
- Tour initialization flashes / visible backdrop
- Backdrop covers only the viewport and can be scrolled away HOT 12
- Offset calculation of highlighted element is wrong sometimes HOT 3
- reflexOnly: true allow proceed if using keyboard arrows HOT 3
- Element not clickable when its ancestor has a position fixed and z-index lower than the tour-backdrop which is sibling HOT 2
- [Feature request] Add highlight padding option HOT 2
- [Feature request] Ability to highlight multiple elements at once HOT 1
- incorrect isOrphan Step detection under certain conditions HOT 6
- Misplaced tour if target element has overflow:auto CSS HOT 2
- Angular HOT 4
- backdropPadding HOT 1
- FYI: FIXING ISSUES DURING PANDEMIC HOT 3
- Issue with pause-resume buttons HOT 1
- Next button partially working at the end of the tour. HOT 2
- Bootstrap 4.5 compatibility? HOT 1
- $(...).stop is not a function? HOT 1
- Cannot highlight elements with the style display: contents and incorrect highlight position with fixed elements HOT 1
- IGreatlyDislikeJavascript
- Bootstrap 5 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-tourist.