mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-01-15 16:33:35 -03:00
Prevent navigation during horizontal scroll (#6915)
* Prevent unwanted navigation history changes during horizontal scroll on trackpads by evaluating scroll start/end. Prevent unwanted navigation history changes during horizontal scroll on trackpads by evaluating scroll start/end. * Fix code reviews and change event listener opts in all implementacion of scroll navegation wheelEvent, scrollHandler Fix code reviews and change event listener opts in all implementacion of scroll navegation wheelEvent, scrollHandler * remove line space Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -599,6 +599,13 @@ const scrollerFactory = function (frame, options) {
|
||||
let delta = normalizeWheelDelta(event);
|
||||
|
||||
if (transform) {
|
||||
if (o.horizontal && event.deltaX !== 0
|
||||
&& (event.deltaY >= -5 && event.deltaY <= 5)
|
||||
&& (pos.dest + o.scrollBy * delta > 0)
|
||||
&& (pos.dest + o.scrollBy * delta < pos.end)
|
||||
) {
|
||||
event.preventDefault();
|
||||
}
|
||||
self.slideBy(o.scrollBy * delta);
|
||||
} else {
|
||||
if (isSmoothScrollSupported) {
|
||||
@@ -630,7 +637,7 @@ const scrollerFactory = function (frame, options) {
|
||||
});
|
||||
|
||||
dom.removeEventListener(scrollSource, wheelEvent, scrollHandler, {
|
||||
passive: true
|
||||
passive: false
|
||||
});
|
||||
|
||||
dom.removeEventListener(dragSourceElement, 'touchstart', dragInitSlidee, {
|
||||
@@ -794,7 +801,7 @@ const scrollerFactory = function (frame, options) {
|
||||
if (o.mouseWheel) {
|
||||
// Scrolling navigation
|
||||
dom.addEventListener(scrollSource, wheelEvent, scrollHandler, {
|
||||
passive: true
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
} else if (o.horizontal && o.mouseWheel) {
|
||||
@@ -802,7 +809,7 @@ const scrollerFactory = function (frame, options) {
|
||||
|
||||
// Scrolling navigation
|
||||
dom.addEventListener(scrollSource, wheelEvent, scrollHandler, {
|
||||
passive: true
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user