NativeScript / NativeScript/NativeScript
onTap does not recognize longer taps
還沒有人認領這個 Issue。
- 主要語言
- TypeScript
- 星號
- 25.7k
- 分支
- 1.7k
- 平均合併
- 1 天 5 小時
- 30 天內合併 PR
- 35
描述
Is your feature request related to a problem? Please describe.
The onTap event is only triggered by short taps where the finger is released quickly. If you hold down the finger for too long, the onTap event gets cancelled. In terms of accessibility (weak fingers, loss of tactile sensitivity, bad eyesight) and external consistency (compare to standard tap events on Android and iOS built-in apps), this is undesirable. Imagine a user that has weakened fingers due to for example multiple sclerosis, who adopts a usage pattern where buttons are tapped for seconds at a time to ensure that the button was hit.
There is a longPress event but that does not trigger on release like onTap so it does not solve the problem.
Describe the solution you'd like
The onTap event should not be cancelled by default for longer presses.
Describe alternatives you've considered
A workaround for that worked for us is to use the touch event instead of onTap, and check if the action type was "up".
This is what it looks like in vue in the context of a RadListView:
<Ripple
@touch="onItemSelected($event, index)"
...
private onItemSelected(event, index): void {
if (event.action === "up") {
//Do the thing
}
}
Additional context
Relevant WCAG guideline: https://www.w3.org/TR/WCAG21/#pointer-cancellation
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先定位 onTap 事件的進入點,以及 NativeScript 控制項使用的觸控事件處理方式。比較短按與長按的釋放動作如何處理,接著根據所要求的無障礙結果檢查相關的 Android 與 iOS 行為。完成的標準是:較長時間的按壓在釋放時觸發 onTap,同時不破壞 longPress 行為,並涵蓋兩個平台。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- typescript
- 領域
- accessibility, mobile-dev
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100