NativeScript / NativeScript/NativeScript

Tap events propagating when isPassThroughParentEnabled = false;

Open
#6,606 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug os: android
Dominant language
TypeScript
Stars
25.7k
Forks
1.7k
Avg merge
1d 5h
Merged PRs (30d)
35

Description

Environment

  • CLI: 5.0.1
  • Cross-platform modules: 5.0.3
  • Android Runtime: 5.0.0
  • iOS Runtime: 5.0.0

Describe the bug

Tap events are being propagated to parent objects, even when isPassThroughParentEnabled = false;

To Reproduce

Add nested tap events to the objects, a Label with a tap inside a StackLayout with another tap is enough, the StackLayout event will be fired even when the touch is on the Label.

<ScrollView tap="test">
    <StackLayout tap="test">
       <Label text="Touch this label" tap="test" textWrap="true"/>
    </StackLayout>
</ScrollView>
export function test(args: EventData) {
    (<any>args.object).isPassThroughParentEnabled = false; // This seems to be ignored
    console.log("Touch on " + args.object);
}

Expected behavior

Taps not being propagated when isPassThroughParentEnabled is set to false.

Sample project

https://play.nativescript.org/?template=play-tsc&id=pj7FjN
Tap the label and see a log for each element.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked NativeScript Playground sample and reproduce the nested tap handlers on the Label, StackLayout, and ScrollView. Trace the event propagation path for isPassThroughParentEnabled on Android and iOS, then add regression coverage; done means tapping the Label no longer logs parent handlers when the property is false.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.