primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.15k stars 4.54k forks source link

Carousel: does not allow scrolling vertically on mobile #13266

Open Xriuk opened 1 year ago

Xriuk commented 1 year ago

Describe the bug

When scrolling the page on mobile, if the touch lands on the carousel it is not possible to scroll further down, even if the scroll is vertical. This can be seen directly on the components page of the site.

Environment

...

Reproducer

https://primeng.org/carousel

Angular version

...

PrimeNG version

...

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

...

Browser(s)

No response

Steps to reproduce the behavior

Expected behavior

The carousel should allow scrolling vertically while "blocking" the user, only when it scrolls horizontally

ChristoSmuts commented 1 year ago

I am experiencing the same issue.

In my testing it seems to not do this on the iPhone SE (2022) with Chrome browser. But with the Samsung S23 Ultra using Chrome the carousel stops the page from scrolling vertically when the touch is initiated on the carousel, but when the touch starts off the carousel the page scroll behaves as expected.

Xriuk commented 1 year ago

I tried on Android on Firefox and Chrome

ChristoSmuts commented 1 year ago

I found this: https://github.com/primefaces/primeng/issues/11607#issuecomment-1163017276 and it worked for me.

Added this to my TS file:

import { Carousel } from 'primeng/carousel';

constructor() { Carousel.prototype.onTouchMove = () => { }; }

I have not stress tested this yet, but so far it seems to do the trick.