fix: 手机左右滑动切换页面不生效 #43

Merged
fam merged 1 commits from fix/mobile-swipe-tabs into main 2026-04-16 14:02:20 +00:00
Contributor

根因

浏览器默认处理水平手势(iOS Safari 左滑后退、Chrome overscroll),抢在 JS touchend 之前消费了事件。

修复

  • touch-action: pan-y 告诉浏览器只处理垂直滚动,水平留给 JS
  • touchmove 实时跟踪手指位置,不再依赖 touchend.changedTouches(在某些浏览器中不可靠)
  • touchstart 的 target 做 no-swipe 区域判断(移动后 target 可能变)
  • 弹窗打开时跳过
  • 阈值 50→60px 减少误触
## 根因 浏览器默认处理水平手势(iOS Safari 左滑后退、Chrome overscroll),抢在 JS touchend 之前消费了事件。 ## 修复 - `touch-action: pan-y` 告诉浏览器只处理垂直滚动,水平留给 JS - `touchmove` 实时跟踪手指位置,不再依赖 `touchend.changedTouches`(在某些浏览器中不可靠) - `touchstart` 的 target 做 no-swipe 区域判断(移动后 target 可能变) - 弹窗打开时跳过 - 阈值 50→60px 减少误触
fam added 1 commit 2026-04-16 13:34:59 +00:00
fix: 手机左右滑动切换 tab 不生效
All checks were successful
PR Preview / test (pull_request) Has been skipped
Deploy Production / test (push) Successful in 7s
PR Preview / teardown-preview (pull_request) Successful in 14s
PR Preview / deploy-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
Deploy Production / deploy (push) Successful in 6s
Test / e2e-test (push) Successful in 3m1s
bac5e0a26a
- 加 touch-action: pan-y 阻止浏览器抢占水平手势
- 用 touchmove 实时跟踪手指位置(比 touchend.changedTouches 更可靠)
- 用 touchstart 的 target 判断 no-swipe 区域(手指移动后 target 可能变)
- 弹窗/遮罩层打开时跳过滑动切换
- 阈值从 50px 调到 60px 减少误触

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner

🚀 Preview: https://pr-43.oil.oci.euphon.net

DB is a copy of production.

🚀 **Preview**: https://pr-43.oil.oci.euphon.net DB is a copy of production.
fam merged commit bac5e0a26a into main 2026-04-16 14:02:20 +00:00
Owner

🗑️ Preview torn down.

🗑️ Preview torn down.
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hera/oil-formula-calculator#43