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
useModalOverlay not working after few steps #895
Comments
@porespod it sounds like you might be targeting the wrong element. Try targeting the parent of the element you want to target. I'm guessing the elements you are trying to target do not have a width and height and |
But it works well in Microsoft Edge, the previous one using Chrome. Anyway, can I change the distance for the popup? As you can see the popup is too near the target element. |
@porespod yes, please use If something is broken in Chrome, please provide a reproduction, and we can take a look, but it is likely as I mentioned, that you need to target a different element or wrap in a div with the dimensions you want, etc. |
@porespod I'm not sure what you have going on there. |
Yes, following based on the Popper docs on offset. I don't know how to apply it :/ |
@porespod use |
Hey, thank you for your help! I managed to change the offset already :) |
Hey, I still have problem with the overlay :/
|
@porespod can you please create a minimal reproduction using something like codepen etc and also tell us what your problem is you are seeing? |
https://codepen.io/porespod/pen/bGVVVGq After few element, it doesn't fully highlight it. |
@porespod check the console, |
Also, your codepen does not run. You cannot use |
Also, do not include popper manually please. You should follow the Shepherd docs. Use https://cdn.jsdelivr.net/npm/shepherd.js@7.1.1/dist/js/shepherd.js and https://cdn.jsdelivr.net/npm/shepherd.js@7.1.1/dist/css/shepherd.css in your global codepen settings to add them and then make sure the codepen functions without console errors. I suspect you have the same issue in your code, where the element does not exist. |
how do i resolve this problem? if doesn't exist the element supposedly not highlighted, but #upload is the first highlighted element. |
This is how i wrote it in my code editor. |
You have to make sure the element exists before trying to use it as a target. You'll want to use something that ensures the page is done rendering, then setup the tour. The timing of this is up to you, not up to Shepherd.
Yes, but it is wrong. First, I have said a few times now, please stop including popper. Remove the popper line please, please! Also, you are required to add the shepherd CSS as well. JavaScript files do not have script tags, Script tags go in HTML files. |
Hey mate, sorry about that. I've removed the poppers line and script tags in JavaScript files and added Shepherd CSS as well. However, the problem still occurs even tho the element exists. Try look at the demo. I see that the problem occurs after scrolling half of the page. I try to target the wrapper, and it only covers half of the page. |
@porespod please create a minimal reproduction. There are far too many other scripts and styles in this codepen. I suspect some of that is interfering somehow. If you are able to reproduce this in a codepen that only includes Shepherd, I would be very surprised. |
Here, I have removed scripts and styles that don't affect the view. |
@porespod if you remove this: <!-- Main stylesheets (template main css file) -->
<link href="https://www.allsomedock.com/media/design/admin/css/main.css" rel="stylesheet" /> It fixes things. Something in there is conflicting with Shepherd. |
Oh yesss! Do you know what might be the things in the CSS that clash with speherd? |
@porespod any of those could be the culprit. I recommend removing a few styles at a time, until you find the issue. Since this is not a Shepherd bug, I am closing this. Good luck! |
@rwwagner90 Hi, I have similar issue with not highlighting element after few steps #895 (comment) : This element should be highlighted:
Code: $(function () {
if (!document.querySelector('#payment-form')) {
return;
}
const navbar = document.querySelector('.onboardingWizard-nav');
const navbarItems = [...navbar.querySelectorAll('.onboardingWizard-nav-item')];
const steps = [
{
text: 'TEST will be the default in the plugin. You only need to do the configuration once to have TEST
stepClass: 'right-bottom',
classActive: 'api-settings',
attachToElement: '.onboardingWizard-environment',
btnBackText:'Go back',
btnNextText: 'Next <i class="icon angle right"></i>',
btnNextClass: 'with-triangle',
btnCollapseClass: 'btn-collapse',
},
{
text: 'Fill in your correct details and click "TEST API Key"\n' +
'\n' +
'Learn about the difference between: Orders API or the Payments API',
stepClass: 'step-5 right-bottom',
classActive: 'api-settings',
btnBackText:'Go back',
btnNextText: 'Next <i class="icon angle right"></i>',
btnNextClass: 'with-triangle',
attachToElement: '[for="sylius_payment_method_gatewayConfig_config_api_key_test"] + *',
btnCollapseClass: 'btn-collapse',
},
{
text: 'Enabling components, allows you to add the fields needed for credit card holderr own\n' +
'checkout. If you select NO, users will be redirected to the Mollie\n' +
'checkout page',
stepClass: 'right-bottom',
classActive: 'store-settings',
btnBackText:'Go back',
btnNextText: 'Next <i class="icon angle right"></i>',
btnNextClass: 'with-triangle',
attachToElement: '.onboardingWizard-components',
btnCollapseClass: 'btn-collapse',
},
];
function navbarVisibilityHandler() {
navbar.classList.toggle('d-none', !tour.isActive());
navbar.setAttribute('aria-hidden', tour.isActive());
}
const tour = new Shepherd.Tour({
useModalOverlay: true,
confirmCancel: false,
defaultStepOptions: {
class: 'onboardingWizard-popup',
arrow: false,
cancelIcon: {
enabled: true,
},
scrollTo: { behavior: 'smooth', block: 'center' },
modalOverlayOpeningRadius: 4,
},
});
['inactive', 'show'].forEach(event => tour.on(event, navbarVisibilityHandler));
steps.forEach((step, index) => {
tour.addStep({
id: step.id,
title: step.title ? step.title : null,
text: step.text,
classes: step.stepClass,
attachTo: {
...(step.attachToElement && { element: step.attachToElement }),
on: 'top-start'
},
...(step.classActive && { highlightClass: step.classActive }),
buttons: [
{
text: step.btnBackText,
action() {
if (index === 0) {
tour.complete();
} else {
tour.back();
}
},
secondary: true,
...(step.btnBackClass && { classes: step.btnBackClass }),
},
{
text: step.btnNextText,
action() {
if(index === steps.length - 2) {
tour.complete();
} else {
tour.next();
}
},
...(step.btnNextClass && { classes: step.btnNextClass }),
},
],
});
});
tour.start();
}) highlighting on element |
@gromen it seems like you are using an older version of Shepherd and/or need to update your usage. What version are you on? |
@rwwagner90 thank you for your response - I'm on v8.2.3 - I'm using https://cdn.jsdelivr.net/npm/shepherd.js@8.2.3/dist/js/shepherd.min.js for test purposes |
@gromen you likely need to update your code then. It seems like your implementation is from many versions ago. |
@rwwagner90 this solved my problem 😃 🎊 #1340 (comment) I have attached |
There are few addStep I used, however, after step four, the overlay doesn't create an opening around my remaining target element (next step till the end).
Does anyone know how to solve this problem? Please help :(
Thank you in advance!
The text was updated successfully, but these errors were encountered: