tnicola / ngx-joyride

Angular Joyride/Tour library
https://tnicola.github.io/ngx-joyride/
MIT License
245 stars 95 forks source link

Autoscroll not working with a div containing a button #70

Open ziacik opened 5 years ago

ziacik commented 5 years ago

Describe the bug Having a div and inside it a button. With a joyride step set on the div when the tour starts, it scrolls down to the bottom of the page. I think it has something to do with this https://github.com/tnicola/ngx-joyride/commit/2ff80c75f69c53dc15d47674400dea36525df1db#diff-4295369960d88d9b10bf1a0b9717ec0cR47 It works ok if I explicitly set "overflow:auto" on that div.

To Reproduce See https://stackblitz.com/edit/angular-snkgan

Expected behavior Should scroll to the div.

Details (please complete the following information):

marbletravis commented 5 years ago

Seeing the same thing here.

fpichlou commented 4 years ago

I've been seeing the same error!

fpichlou commented 4 years ago

One of the my steps was hidden and I fixed the issue by importing JoyrideStepService and changed the scrollIfElementBeyondOtherElements method to public access (in the joyride-step.service in package), and call it in the first callback method in the subscription of startTour observable. It means changing view scroll if element is beyond other elements has a bug! @tnicola