perfect-scrollbar icon indicating copy to clipboard operation
perfect-scrollbar copied to clipboard

scroll bar keeps scrolling down exceeding contents length

Open shubhcosmos opened this issue 4 years ago • 57 comments

Make sure these boxes are checked before submitting your issue -- thank you!

  • [ ] Check FAQ and Caveats
  • [ ] Search if there's already one reported in Issues
  • [ ] Prepare a JSFiddle reproducing the issue
  • [ ] Provide a page or source code where the issue can be checked image

issue no 756 this did not fix the issue , I have latest changes but still it does not works

shubhcosmos avatar Feb 14 '20 07:02 shubhcosmos

Since 1.4.0 update to 1.5.0 i also facing this problem

kfeng0806 avatar Feb 16 '20 22:02 kfeng0806

@shubhcosmos Will it be fixed in future release?

GuichiZhao avatar Feb 18 '20 15:02 GuichiZhao

try this fix amd the root cause it works fine

Issue is when you keep scrolling top attribute of ps--rail-y div keeps adding up . So the content height of container div keeps increasing .

in this Fix I have checked that dont increase the top property when top+ innerheight is greater than scroll height

perfect-scrollbar\dist\perfect-scrollbar.esm.js

function updateCss(element, i) {

line 465 onwards

// shubh if(!(element.scrollTop + window.innerHeight >= element.scrollHeight)) { set(i.scrollbarYRail, yRailOffset); }

set(i.scrollbarX, { left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth, });

set(i.scrollbarY, { top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth, });

shubhcosmos avatar Feb 19 '20 06:02 shubhcosmos

The root cause of the issue it changes in update-geometry: This code

i.containerWidth = element.clientWidth;
i.containerHeight = element.clientHeight;

was replaced with this one:

const rect = element.getBoundingClientRect();
i.containerWidth = Math.ceil(rect.width);
i.containerHeight = Math.ceil(rect.height);

getBoundingClientRect does not take into account borders on the container element. So if you have the borders - I'll get the bug with infinite scroll.

statyan avatar Feb 24 '20 22:02 statyan

The root cause of the issue it changes in update-geometry: This code

i.containerWidth = element.clientWidth;
i.containerHeight = element.clientHeight;

was replaced with this one:

const rect = element.getBoundingClientRect();
i.containerWidth = Math.ceil(rect.width);
i.containerHeight = Math.ceil(rect.height);

getBoundingClientRect does not take into account borders on the container element. So if you have the borders - I'll get the bug with infinite scroll.

I have issue with horizontal scroll on touch device but container without border, it scroll exceed the container width

kfeng0806 avatar Feb 25 '20 07:02 kfeng0806

I had to rollback to 1.4.0 because of this issue.

dexcell avatar Feb 25 '20 16:02 dexcell

what are the steps to reproduce this issue?

mattonit avatar Feb 26 '20 07:02 mattonit

here representation of bug perfect scrolbar bug 1.5.0

also recreated on X

Dev1lDragon avatar Feb 27 '20 12:02 Dev1lDragon

it probably cause by rails, rail-y on mouse scroll and rail-x happend on touch device

kfeng0806 avatar Mar 02 '20 21:03 kfeng0806

Please try my fix mdbootstrap/Tailwind-Elements#934 for this issue

supersnager avatar Mar 23 '20 10:03 supersnager

Just added one more fix, after testing in some different cases.

supersnager avatar Mar 23 '20 15:03 supersnager

This issue is easily reproducible in IE, with resolution of 1366 *768. When a container have a height of 456 then it is going continuously downwards.

pushpendersingh97 avatar Mar 27 '20 12:03 pushpendersingh97

@pushpender98 have you tested it with my fix?

supersnager avatar Mar 28 '20 09:03 supersnager

@supersnager yes it is still coming when the parent div have height in points.

pushpendersingh97 avatar Mar 28 '20 13:03 pushpendersingh97

Try my fix above and the reason i debugged it , its tested and working fine on dev and prod

shubhcosmos avatar Mar 28 '20 13:03 shubhcosmos

@supersnager thanks for fix, i tried your fix on master but the issue still exists

kfeng0806 avatar Mar 28 '20 21:03 kfeng0806

@kfeng0806 for fix in master you need to rebuild dist files

Dev1lDragon avatar Mar 28 '20 23:03 Dev1lDragon

@Dev1lDragon Thanks for the tips, after rebuild it proves the fix works :) And thanks @supersnager again, you are life saver 👍

kfeng0806 avatar Mar 29 '20 13:03 kfeng0806

I have tried it at my end, and this issue is still coming in the IE. Please have a look upon it.

image

pushpendersingh97 avatar Mar 30 '20 06:03 pushpendersingh97

@pushpender98 Please provide an example on jsfiddle or as github project, i will try to fix it.

supersnager avatar Mar 30 '20 14:03 supersnager

@supersnager , This issue is occuring in IE only at some specific version. So not able to reproduce on jsfiddle. image

pushpendersingh97 avatar Mar 31 '20 06:03 pushpendersingh97

@pushpender98 Sorry, but i can't help if it's not possible to reproduce this issue

supersnager avatar Mar 31 '20 09:03 supersnager

@pushpender98 try to find in your compiled js file Math.ceil and after that Math.round if you find first you don't compiled js to work.

Dev1lDragon avatar Mar 31 '20 22:03 Dev1lDragon

This happens even with v1.3.0, @dexcell I doubt rolling back to 1.4.0 would fix it? Unless this is yet another regression issue after 1.4.0?

totszwai avatar May 07 '20 15:05 totszwai

Is it possible to make stable release with this fix?

supersnager avatar May 14 '20 06:05 supersnager

If you are adding border to div element like me, please you don't do it. I don't know root cause but when you are remove border outside of div element the problem is solving.

Borlu avatar May 26 '20 04:05 Borlu

I also have this issue. Happening on Chrome 81. Outside div does not have border, nor inside one.

fnfilho avatar May 27 '20 20:05 fnfilho

I also have this issue. Happening on Chrome 81. Outside div does not have border, nor inside one.

@fnfilho Problem exists with or without my fix?

supersnager avatar May 29 '20 07:05 supersnager

I wasn't able to test it because I am using it through another dependency for React. Would need the stable release to force npm to use that

fnfilho avatar May 29 '20 11:05 fnfilho

1.5 is really buggy. Rolled back to 1.4

invisor avatar Jun 02 '20 19:06 invisor