René's URL Explorer Experiment


Title: Improve gestures to allow for cancellation, interception and customizability · Issue #7310 · NativeScript/NativeScript · GitHub

Open Graph Title: Improve gestures to allow for cancellation, interception and customizability · Issue #7310 · NativeScript/NativeScript

X Title: Improve gestures to allow for cancellation, interception and customizability · Issue #7310 · NativeScript/NativeScript

Description: Is your feature request related to a problem? Please describe. Currently, there is no way to cancel or intercept a gesture. Example: if you set a tap to a child and a parent, both will trigger. Custom gestures must also be handled manual...

Open Graph Description: Is your feature request related to a problem? Please describe. Currently, there is no way to cancel or intercept a gesture. Example: if you set a tap to a child and a parent, both will trigger. Cus...

X Description: Is your feature request related to a problem? Please describe. Currently, there is no way to cancel or intercept a gesture. Example: if you set a tap to a child and a parent, both will trigger. Cus...

Opengraph URL: https://github.com/NativeScript/NativeScript/issues/7310

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve gestures to allow for cancellation, interception and customizability","articleBody":"**Is your feature request related to a problem? Please describe.**\r\nCurrently, there is no way to cancel or intercept a gesture. Example: if you set a `tap` to a child and a parent, both will trigger. Custom gestures must also be handled manually with `touch` events.\r\n\r\nMore often than not, when using `tap`, you just want one `tap` to trigger. Say you have a card and an user picture inside the card. If you tap anywhere on the card you want to open a URL or show more details about the card, if you tap on the user picture, you want to show the user profile. Currently this completely breaks in {N} and requires workarounds, while works out of the box (and is the default behavior) in other frameworks. This makes developing complex UIs frustrating and actually recudes the usability of `TappableSpan`s #7076, since you can't reliably create a `tap` for a URL and another for the text, for example. If you check apps like Facebook and Instagram, this is used absolutely everywhere.\r\n\r\n**Describe the solution you'd like**\r\nA Gesture Arena with `HitTestBehavior` and `AllowMultipleGestureRecognizer`, similar to Flutter (https://medium.com/flutter-community/flutter-deep-dive-gestures-c16203b3434f), but allowing better bubbling (it seems flutter does not allow for two events of the same kind to be trigger simultaneously, like parent and child `tap`).\r\n\r\nThe current {N} implementation is like `AllowMultipleGestureRecognizer = true` and `HitTestBehavior = translucent`, but with the added factor that no event is unique. Multiple gestures are recognized loosely and they all bubble to the parents.\r\n\r\nIdeally, we should be able to set additional properties to each event of a view (`tap`, `drag`, etc), register our own gesture recognizers (like a raw gesture that returns true when recognized), and generate relations between them (custom gesture can't trigger along with child/parent `swipe`, or child `tap` has precedence over parent `tap` or vice-versa, for example).\r\n\r\nHonestly, any implementation that allows the user to eat an event type would work better than the current bubbling.\r\n\r\n**Describe alternatives you've considered**\r\nUsing booleans to detect child events and gesture detection and discard events when needed. This adds a lot of complexity in the UI code.\r\n\r\n**Additional context**\r\n\r\nI've already done some research on the possible implications and implementations. Maybe we could work on a proper API proposal.\r\n\r\n**iOS:**\r\n\r\nCurrently, we're already running all recognizers simulaneously. This behavior can be expanded to add relations. Since we have `owner` references, we should be able to get these dynamically for the view (https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers)\r\n https://github.com/NativeScript/NativeScript/blob/7d3f0d9e96976d257b17f9019ea0d101b827572f/tns-core-modules/ui/gestures/gestures.ios.ts#L18-L20\r\n\r\nUsing the same `owner` references, we could also do the same when deciding for exclusivity, or discarding similar events if that's what the view wants\r\n(https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers/preferring_one_gesture_over_another)\r\n\r\n**Android:**\r\n\r\nEvery `touchable` view on android returns `true` on `onTouchEvent`, so the event is always intercepted by the furthest child in the chain (http://codetheory.in/understanding-android-input-touch-events/). {N} solves this via an undocumented breaking change of NS 5.0 (mistakenly opened as #6606) in which all `MotionEvent`s bubble up to their parents indiscriminately.\r\n\r\nhttps://github.com/NativeScript/NativeScript/blob/cf533a7b6d6607aefd39c06978578bb2b453eb3d/tns-core-modules/ui/core/view/view.android.ts#L397-L399\r\n\r\n\r\nThis behavior can be solved in Android by passing additional data up the chain, like what events were triggered by the `MotionEvent`. `android.view.GestureDetector` triggers them synchronously, so we could store a `triggered` variable that sets itself when an event has been triggered, which is later reset by the `GesturesObserver` which is handling it.\r\n\r\nhttps://github.com/NativeScript/NativeScript/blob/05c2460fc4989dae4d7fa1ee52f6d54e0c3113f5/tns-core-modules/ui/gestures/gestures.android.ts#L333-L335\r\n\r\n```\r\nif(this._simpleGestureDetector.triggeredEvent) {\r\ntriggeredEvents.push(this._simpleGestureDetector.triggeredEvent);\r\nthis._simpleGestureDetector.triggeredEvent = null;\r\n}\r\n...\r\n// check triggeredEvents self dependency\r\n// trigger exclusive events (that can't be bubbled up)\r\n// bubble up events that can be bubbled up\r\n// on the topmost (activity) actually trigger all events that were queued\r\n```\r\n\r\nPossible edge case: parent wants to intercept event but child doesn't want bubbling.\r\n\r\n\r\n\u003cbountysource-plugin\u003e\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/75078809-improve-gestures-to-allow-for-cancellation-interception-and-customizability?utm_campaign=plugin\u0026utm_content=tracker%2F12908224\u0026utm_medium=issues\u0026utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin\u0026utm_content=tracker%2F12908224\u0026utm_medium=issues\u0026utm_source=github).\r\n\u003c/bountysource-plugin\u003e","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2019-06-04T22:50:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/7310/NativeScript/issues/7310"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d3f6120e-b0a8-5502-e160-667ae200292d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEA94:67DD8:87F5817:BA559A2:6973A6AA
html-safe-noncee0b87ad66178172eced07ea27c61748c10fa40c28e0aad3dcb878ae29aaa7e4c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTk0OjY3REQ4Ojg3RjU4MTc6QkE1NTlBMjo2OTczQTZBQSIsInZpc2l0b3JfaWQiOiI2MDQ4ODk4NTkxMzEwOTgwNzc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacfe589b30c86086932c9afaf58e8302465c0ddf90cd161dcd6fed91b3ce824dbc
hovercard-subject-tagissue:452241581
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/7310/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1adaa2c6507c2e7d5a1e1c834d1a8a3336b0a488e6cc981c50fb9d52ff3a043c/NativeScript/NativeScript/issues/7310
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1adaa2c6507c2e7d5a1e1c834d1a8a3336b0a488e6cc981c50fb9d52ff3a043c/NativeScript/NativeScript/issues/7310
og:image:altIs your feature request related to a problem? Please describe. Currently, there is no way to cancel or intercept a gesture. Example: if you set a tap to a child and a parent, both will trigger. Cus...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameedusperoni
hostnamegithub.com
expected-hostnamegithub.com
None3e9aa9d0c22a21b13b378b4acd09f5dd4876a884425aacd32a9f473b84c8762d
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseae4dbd3ac4179af799d71b75a60b0075ccccc5f6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/issues/7310#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F7310
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F7310
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/issues/7310
Reloadhttps://github.com/NativeScript/NativeScript/issues/7310
Reloadhttps://github.com/NativeScript/NativeScript/issues/7310
NativeScript https://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/7310
Notifications https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Fork 1.7k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Star 25.4k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Code https://github.com/NativeScript/NativeScript
Issues 869 https://github.com/NativeScript/NativeScript/issues
Pull requests 59 https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects 0 https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security 0 https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
Code https://github.com/NativeScript/NativeScript
Issues https://github.com/NativeScript/NativeScript/issues
Pull requests https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/NativeScript/issues/7310
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/NativeScript/issues/7310
Improve gestures to allow for cancellation, interception and customizabilityhttps://github.com/NativeScript/NativeScript/issues/7310#top
featurehttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22feature%22
https://github.com/edusperoni
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Jun 4, 2019https://github.com/NativeScript/NativeScript/issues/7310#issue-452241581
#7076https://github.com/NativeScript/NativeScript/pull/7076
https://medium.com/flutter-community/flutter-deep-dive-gestures-c16203b3434fhttps://medium.com/flutter-community/flutter-deep-dive-gestures-c16203b3434f
https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizershttps://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers
NativeScript/tns-core-modules/ui/gestures/gestures.ios.tshttps://github.com/NativeScript/NativeScript/blob/7d3f0d9e96976d257b17f9019ea0d101b827572f/tns-core-modules/ui/gestures/gestures.ios.ts#L18-L20
7d3f0d9https://github.com/NativeScript/NativeScript/commit/7d3f0d9e96976d257b17f9019ea0d101b827572f
https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers/preferring_one_gesture_over_anotherhttps://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers/preferring_one_gesture_over_another
http://codetheory.in/understanding-android-input-touch-events/http://codetheory.in/understanding-android-input-touch-events/
#6606https://github.com/NativeScript/NativeScript/issues/6606
NativeScript/tns-core-modules/ui/core/view/view.android.tshttps://github.com/NativeScript/NativeScript/blob/cf533a7b6d6607aefd39c06978578bb2b453eb3d/tns-core-modules/ui/core/view/view.android.ts#L397-L399
cf533a7https://github.com/NativeScript/NativeScript/commit/cf533a7b6d6607aefd39c06978578bb2b453eb3d
NativeScript/tns-core-modules/ui/gestures/gestures.android.tshttps://github.com/NativeScript/NativeScript/blob/05c2460fc4989dae4d7fa1ee52f6d54e0c3113f5/tns-core-modules/ui/gestures/gestures.android.ts#L333-L335
05c2460https://github.com/NativeScript/NativeScript/commit/05c2460fc4989dae4d7fa1ee52f6d54e0c3113f5
Post a bounty on it!https://www.bountysource.com/issues/75078809-improve-gestures-to-allow-for-cancellation-interception-and-customizability?utm_campaign=plugin&utm_content=tracker%2F12908224&utm_medium=issues&utm_source=github
Bountysourcehttps://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908224&utm_medium=issues&utm_source=github
featurehttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22feature%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.