tabs icon indicating copy to clipboard operation
tabs copied to clipboard

Tab bar prevents swipe up/down on mobile browser

Open irvanherz opened this issue 3 years ago • 3 comments

Hi, actually I'm coming here because of an issue that I've found in ant-design's tab. I recently discovered that the location of the problem was in rc-tabs. So I tried cloning the master branch and inspecting where the problem was. Finally I found that this problem can be solved by removing e.preventDefault() in useTouchMove.ts file.

You can see it on the branch I forked: https://github.com/irvanherz/tabs/commit/251d8713e6751650f52585d83aa9349c9f7a13c8#diff-6098251a64dc37073e837fba36078438a119c06311050fdbc9975bcbd632c60e

Is this small change ok to fix the bug?

Reproduction link

Edit on CodeSandbox

Steps to reproduce

From any mobile browser, try to swipe view up or down by starting finger touching Tabs' bar.

What is expected?

It should scrolling view up/down as I swipe.

What is actually happening?

It does nothing.

Environment Info
antd 4.13.1
React 17.0.1
System Android 7.1.2; Redmi 5A Build/N2G47H
Browser Chrome Version 88.0.4324.181

My project using many tabs at home page. This bug oftenly brings problem for any users who open the page from mobile browser.

irvanherz avatar Mar 12 '21 14:03 irvanherz

Hi team,

This issue occurs for us too, and once we removed the e.preventDefault(); from /hooks/useTouchMove.ts line number 34 working fine for us.

pplcallmesatz avatar Oct 14 '21 05:10 pplcallmesatz

You don't have to edit code in node_modules, only add event touchmove on parent element of target element that register event to prevent you scroll. Afterward you add ev.stopPropagation() with ev is parameter to event handler. Problem resolved!

hnhattien avatar May 01 '22 12:05 hnhattien

You don't have to edit code in node_modules, only add event touchmove on parent element of target element that register event to prevent you scroll. Afterward you add ev.stopPropagation() with ev is parameter to event handler. Problem resolved!

Which parent element? And why does this work?

Chorer avatar Dec 06 '22 01:12 Chorer