You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMPORTANT:Although, I have successfully created a reproduction, this issue can only be reproduced under specific circumstances due to it being influenced by monitor DPI (or something like that). I can literally drag the browser window from one monitor to another to toggle whether the bug appears, so read the description below carefully to understand what exactly I'm seeing.
Description
When I open the reproduction above in my browser (it is nothing but an index.html file) on my Macbook Pro's internal display, the Swiper does not correctly detect when it has been scrolled to the end.
The Swiper is in cssMode: true, so when I say "scrolled to the end" I mean that I've hovered my mouse over the .swiper-wrapper element and scrolled with two fingers horizontally to the end of the scrollable area inside the element.
When I do so, the .swiper-button-next element should have gotten the .swiper-button-disabled class, because the Swiper is at the end and therefore is not able to scroll further. However, the button remains unchanged. If the button is clicked, the Swiper then correctly detects that it is at the end and toggles the class correctly.
My Digging
I did some digging to save you some time, or in the case that you cannot reproduce the behavior with your monitor setup. Here's what I found.
When I add a breakpoint in core/update/updateProgress.js on line 20, the state when the Swiper has been scrolled all the way to the end is as follows:
The Swiper cannot at this point be scrolled further, although from the number it seems that it should. So it seems that either some math in there is wrong, or the progress should be relaxed to consider the Swiper to be at the end if it is within 1 pixel of the "expected" end value.
Also, the reason I didn't check off the "I'm willing to open a PR" task is because after digging through the source code I'm still not sure exactly what the root cause of this issue is, and I'm not confident that baking a version of my "band-aid" solution into the source code would be an acceptable fix.
Check that this is really a bug
Reproduction link
https://github.com/AaronBeaudoin/swiper-bug
Bug description
IMPORTANT: Although, I have successfully created a reproduction, this issue can only be reproduced under specific circumstances due to it being influenced by monitor DPI (or something like that). I can literally drag the browser window from one monitor to another to toggle whether the bug appears, so read the description below carefully to understand what exactly I'm seeing.
Description
When I open the reproduction above in my browser (it is nothing but an
index.html
file) on my Macbook Pro's internal display, the Swiper does not correctly detect when it has been scrolled to the end.The Swiper is in
cssMode: true
, so when I say "scrolled to the end" I mean that I've hovered my mouse over the.swiper-wrapper
element and scrolled with two fingers horizontally to the end of the scrollable area inside the element.When I do so, the
.swiper-button-next
element should have gotten the.swiper-button-disabled
class, because the Swiper is at the end and therefore is not able to scroll further. However, the button remains unchanged. If the button is clicked, the Swiper then correctly detects that it is at the end and toggles the class correctly.My Digging
I did some digging to save you some time, or in the case that you cannot reproduce the behavior with your monitor setup. Here's what I found.
When I add a breakpoint in
core/update/updateProgress.js
on line 20, the state when the Swiper has been scrolled all the way to the end is as follows:The Swiper cannot at this point be scrolled further, although from the number it seems that it should. So it seems that either some math in there is wrong, or the progress should be relaxed to consider the Swiper to be at the end if it is within 1 pixel of the "expected" end value.
Expected Behavior
No response
Actual Behavior
No response
Swiper version
8.4.5
Platform/Target and Browser Versions
macOS Chrome 108.0.5359.124 arm64
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: