FormidableLabs / FormidableLabs/react-swipeable

`preventScrollOnSwipe` does not work while focused on input

Đang mở
#335 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
2.1k
Fork
149
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Describe the bug**
When an input field is focused on ios Safari, preventScroll flag does not work as intended, IE, the page still scrolls.

**Steps or Sandbox to reproduce**
This has to be reproduced inside an ios simulator like xCode or on your mobile device directly
- Wrap a div with scroll handlers:
```js
const handlers = useSwipeable({
onSwiping: ({ deltaY }) => {
if (deltaY > 100) {
document.getElementById('AddModal').close();
}
},
delta: { left: 100, right: 100, down: 100 },
preventScrollOnSwipe: true,
});
```
- Place an input inside of this container
- Place a `ref` on this input
- when the component mounts, focus the input:
```js
useEffect(() => {
inputRef.current.focus();
}, []);
```
-While focused on the input, attempt to scroll down
- observe the bug: the page will scroll when it shouldnt. You can verify this by removing focus from the input and then attempting to swipe again, and it will trigger the handler and prevent scrolling

**Expected behavior**
It should prevent scrolling behavior if I swipe while focused on an input

** Device/Browser **
Safari iOS 17.0

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ phần triển khai useSwipeable và theo dõi cách preventScrollOnSwipe được áp dụng khi một trường nhập liệu đang được focus. Tái hiện trường hợp được cung cấp trên iOS Safari 17.0, sau đó xác minh rằng trang không còn cuộn trong khi swipe trên trường nhập liệu đang được focus, đồng thời hành vi hiện có của handler vẫn được giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react, typescript
Lĩnh vực
frontend, mobile-dev
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.