fix(virtual-core): treat iOS touchcancel like touchend so interrupted gestures cannot leave touch state stuck #1314
main fromrefs/pull/1314/head·merged by piecyk 🎯 Changes#
On iOS WebKit a touch can end with touchcancel (system gesture, interrupted scroll) instead of touchend. The iOS scroll-anchoring path only listened for touchstart/touchend, so a cancelled touch left _iosTouching stuck true and kept size-correction / anchoring suppressed.
This registers touchcancel on scrollEl with the same onTouchEnd handler and options as touchend, and removes it in the existing cleanup. A unit test dispatches touchstart then touchcancel and asserts the touch state is cleared the same as touchend, and that cleanup drops the listener.
Fixes #1313
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally (
@tanstack/virtual-coreeslint, tsc, and vitest).
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
- Bug Fixes
- Improved iOS touch handling so cancelled touches clear active touch state like ended touches, preventing scroll anchoring from remaining suppressed.
- Touch event listeners are removed when the virtualizer unmounts.
- 1
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
41e2ca0b-5426-4992-8a0e-4957ee28cb3f
📥 Commits
-
Reviewing files that changed from the base of the PR and between 46f73fb419185536ee34ec1c6eba8ad8824d77b7 and dcc52ab52684c7d4b99cb057813ac71a3e8427c2.
📒 Files selected for processing (3)
-
.changeset/ios-touchcancel-clears-touch.mdpackages/virtual-core/src/index.tspackages/virtual-core/tests/index.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
-
📝 Walkthrough
-
Walkthrough#
The virtualizer now handles iOS
touchcancelevents with the existingtouchendlogic. Tests cover touch-state updates and listener cleanup. A patch changeset describes the change.Changes#
iOS touchcancel handling
Layer / File(s) Summary Handle canceled touches and verify cleanup
packages/virtual-core/src/index.ts,packages/virtual-core/tests/index.test.ts,.changeset/ios-touchcancel-clears-touch.mdThe virtualizer uses its existing touch-end handler for touchcanceland removes the listener during cleanup. Tests check touch state, grace-timer state, and listener cleanup. The changeset records the patch.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
piecyk
Merge Risk: ⚪ Minimal · up to
dcc52The change restores touch state after canceled gestures and removes the listener during cleanup. No concrete merge-blocking risk remains.
Pre-merge checks |
4 | 1-
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
-
Check name Status Explanation Title check The title clearly identifies the primary change: treating iOS touchcancel like touchend to prevent stuck touch state. Description check The description explains the motivation, implementation, tests, linked issue, checklist completion, and changeset generation. It matches the repository template. Linked Issues check Issue #1313requirestouchcancelto clear iOS touch state liketouchend, listener cleanup, an automated test, and a changeset. The PR registersonTouchEndfortouchcancelwith thetouchendo…Out of Scope Changes check The reported changes are limited to the iOS touch-state implementation, its focused unit test, and the required @tanstack/virtual-corechangeset. These changes directly support issue#1313. No unrel…
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
🔧 ESLint
-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/virtual-core/tests/index.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/virtual-core/tests/index.test.ts
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
View your CI Pipeline Execution ↗ for commit dcc52ab52684c7d4b99cb057813ac71a3e8427c2
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 4m 6s View ↗ nx run-many --target=build --exclude=examples/**✅ Succeeded 22s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-12 11:25:05UTCMore templates
- tanstack-lit-virtual-example-dynamic
- tanstack-lit-virtual-example-fixed
- tanstack-marko-virtual-example-chat
- tanstack-marko-virtual-example-chat-pretext
- tanstack-marko-virtual-example-dynamic
- tanstack-marko-virtual-example-fixed
- tanstack-marko-virtual-example-grid
- tanstack-marko-virtual-example-infinite-scroll
- tanstack-marko-virtual-example-padding
- tanstack-marko-virtual-example-pretext
- tanstack-marko-virtual-example-scroll-padding
- tanstack-marko-virtual-example-smooth-scroll
- tanstack-marko-virtual-example-ssr
- tanstack-marko-virtual-example-ssr-fetch
- tanstack-marko-virtual-example-ssr-restore
- tanstack-marko-virtual-example-ssr-slice
- tanstack-marko-virtual-example-sticky
- tanstack-marko-virtual-example-table
- tanstack-marko-virtual-example-variable
- tanstack-marko-virtual-example-window
- tanstack-marko-virtual-example-window-ssr-slice
- tanstack-react-virtual-example-chat
- tanstack-react-virtual-example-dynamic
- tanstack-react-virtual-example-fixed
- tanstack-react-virtual-example-infinite-scroll
- tanstack-react-virtual-example-padding
- tanstack-react-virtual-example-pretext
- tanstack-react-virtual-example-scroll-padding
- tanstack-react-virtual-example-smooth-scroll
- tanstack-react-virtual-example-sticky
- tanstack-react-virtual-example-table
- tanstack-react-virtual-example-variable
- tanstack-react-virtual-example-window
- tanstack-svelte-virtual-example-dynamic
- tanstack-svelte-virtual-example-fixed
- tanstack-svelte-virtual-example-infinite-scroll
- tanstack-svelte-virtual-example-smooth-scroll
- tanstack-svelte-virtual-example-sticky
- tanstack-svelte-virtual-example-table
- tanstack-vue-virtual-example-dynamic
- tanstack-vue-virtual-example-fixed
- tanstack-vue-virtual-example-infinite-scroll
- tanstack-vue-virtual-example-padding
- tanstack-vue-virtual-example-scroll-padding
- tanstack-vue-virtual-example-smooth-scroll
- tanstack-vue-virtual-example-sticky
- tanstack-vue-virtual-example-table
- tanstack-vue-virtual-example-variable
- @tanstack/virtual-example-angular-chat
- @tanstack/virtual-example-angular-dynamic
- @tanstack/virtual-example-angular-fixed
- @tanstack/virtual-example-angular-infinite-scroll
- @tanstack/virtual-example-angular-padding
- @tanstack/virtual-example-angular-smooth-scroll
- @tanstack/virtual-example-angular-sticky
- @tanstack/virtual-example-angular-table
- @tanstack/virtual-example-angular-variable
- @tanstack/virtual-example-angular-window
@tanstack/angular-virtual
npm i https://pkg.pr.new/@tanstack/angular-virtual@1314@tanstack/lit-virtual
npm i https://pkg.pr.new/@tanstack/lit-virtual@1314@tanstack/marko-virtual
npm i https://pkg.pr.new/@tanstack/marko-virtual@1314@tanstack/react-virtual
npm i https://pkg.pr.new/@tanstack/react-virtual@1314@tanstack/solid-virtual
npm i https://pkg.pr.new/@tanstack/solid-virtual@1314@tanstack/svelte-virtual
npm i https://pkg.pr.new/@tanstack/svelte-virtual@1314@tanstack/virtual-core
npm i https://pkg.pr.new/@tanstack/virtual-core@1314@tanstack/vue-virtual
npm i https://pkg.pr.new/@tanstack/vue-virtual@1314commit:
dcc52ab@mrosberghaus thanks for the report and the clean fix!
piecyk merged this3800fb3
piecyk closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: dcc52ab52684c7d4b99cb057813ac71a3e8427c2
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR