NativeScript / NativeScript/NativeScript
Tap events propagating when isPassThroughParentEnabled = false;
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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