-
Notifications
You must be signed in to change notification settings - Fork 540
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
Highlight spotlight sometimes is displayed in improper position (scroll related) #376
Comments
I modified the issue title because I found that Keep looking into this... |
OK, I think I found the origin of the issue so I was able to reproduce it on a codesandbox... https://q7oopyqwkq.codesandbox.io/ To reproduce the issue you should resize the browser and use scrolling, for easily explain it here two animation. Here we don't have the issue (I didn't scrolled anywhere): Here the same application but I scrolled a little the page, so you can see the bug: ReasonSeems that problem came from scrollparent.js dependency (so maybe is a bug in this library?). As soon as one of parent element use overflow we fall into this problem. I don't fully understand why scrollparent.js is doing this. Any idea? |
@nicubarbaros no, I just tried to remove overflow usage form my CSS where I was able to do so. |
@keul Damn it. I just removed the spotlight for now. Great plugin but has this issue which is quite harmful. |
Can you please try |
@gilbarbara tested the same codesandbox above (still https://codesandbox.io/s/q7oopyqwkq) after updating to 2.0.0-12 and I've the same issue (the gif I attached is still valid to reproduce the error). |
A quick-and-dirty test for posterity. As I said above the issue seems to came from scrollparent.js but I get no answer from them. If I manually modify the scrollparent.js source file inside my node_modules, removing the scroll check, the error is fixed in my environment. See commented lines below. (function (root, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory();
} else {
root.Scrollparent = factory();
}
}(this, function () {
var regex = /(auto|scroll)/;
var parents = function (node, ps) {
if (node.parentNode === null) { return ps; }
return parents(node.parentNode, ps.concat([node]));
};
var style = function (node, prop) {
return getComputedStyle(node, null).getPropertyValue(prop);
};
var overflow = function (node) {
return style(node, "overflow") + style(node, "overflow-y") + style(node, "overflow-x");
};
var scroll = function (node) {
return regex.test(overflow(node));
};
var scrollParent = function (node) {
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
return ;
}
var ps = parents(node.parentNode, []);
// for (var i = 0; i < ps.length; i += 1) {
// if (scroll(ps[i])) {
// return ps[i];
// }
// }
return document.scrollingElement || document.documentElement;
};
return scrollParent;
})); I'm 100% sure that this code is there for a reason, I guess for handling |
This fix does cause other issues with some components, in my experience. For one component it is throwing the floater off in a big way. Very frustrating. |
@j0o009k as I said above: my fix worked in my environment. I guess you have components where the use of |
@keul - I also have the same issues in my app - this hack to scrollParent also resolves the issue for me. @gilbarbara any chance we can remove the need for this dependancy in a future version? |
Comment out to fix issues with react-joyride as per gilbarbara/react-joyride#376 (comment)
Super hack I put this in the callback for the tour. Code example:
Disclaimer: I have not thoroughly tested this (Chrome only); it was just a quick hack that got me by until the issue is fixed. |
We've just tried upgrading to v2 and we immediately stumbled upon the issue. |
@catamphetamine Can you please try again with |
@gilbarbara |
@catamphetamine |
@gilbarbara I guess it's our code then. Which I can't share. And I wouldn't want to waste your time on digging through some company's website structure. So don't bother, we're fine with v1. Thx. |
@gilbarbara is something changed in the lib packaging? I tried the same old codesandbox with latest
...while doing...
|
...ok, I changed my code to However I have the same position issue: https://codesandbox.io/s/q7oopyqwkq |
@keul I'll try to fix it today! :) |
Ehi @gilbarbara it's working there! 🎉 I don't fully understand what is doing the trick from my codesandbox to your ones! Can you enlight me? |
@keul The |
|
I can confirm, my codesandbox above is now working! Thanks for your time, really appreciated. |
This still happens to me with the very basic use case, when step target out of viewport (down), so it scrolls down, tooltip is correctly placed, but the spotlight is somewhere up in the page. |
Hey @harunurhan Please provide a https://codesandbox.io/ demo or similar. |
@gilbarbara I think my issue is similar to #548, and as it was said in that issue, it is tricky to provide a sandbox reproduction. |
@harunurhan Ok, but that's impossible for me to help without seeing what's going on with the code... |
For those who come across this issue and are looking for a solution, I was having a similar problem with the spotlight being offset when the user had scrolled slightly down the page. It ended up being that in my case I had |
The highlight overlay should be placed normally
In some cases if I use
scrollToFirstStep
the highlight overlay (please note: not the overlay of the first step! Weird...) is placed at the wrong position.See image below:
The highlight overlay should be placed on the plus icon (note that the Floater is at the right position). All is working perfectly when i put
scrollToFirstStep={false}
.That's the sad part... I tried to reproduce with same React and Joyride versions at https://codesandbox.io/s/q7oopyqwkq with no luck. I'm not able to find what is going on there.
If you have any suggestion helping debug this issue let me know, I understand maybe I'm able to provide enough information, so feel free to close the issue if it's not enough for an idea from your side.
15.6.2
2.0.0-11
The text was updated successfully, but these errors were encountered: