UIStackView should not count itself as a valid hit target for touches

Originator:jalkut
Number:rdar://30592429 Date Originated:18-Feb-2017 01:20 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:10.3
Classification:Serious Bug Reproducible:Always
 
Area:
UIKit

Summary:
In some situations, an interface may be served by nesting a UIStackView inside a touchable container view. Currently, if a touch inside a stack view does not pass the hitTest: for any subview, the stack view itself consumes the touch, preventing it from bubbling up to any container view.

Steps to Reproduce:
1. Open attached Untouchables.xcodeproj
2. Build and run.
3. Touch the button and see that it behaves as expected.
4. Touch either yellow area around the button, which are non-interactive UIView instances.

Expected Results:
The touch should have bubbled up to the container Control, which flashes itself red when touched.

Actual Results:
The UIStackView consumes the touch, so it can't bubble up.

Now go into HackStackView.swift, and uncomment the hitTest(...) override. This workaround eliminates the UIStackView itself from consideration as a legitimate hit.

Build and run again, and tap the yellow area. See how the background red illuminates behind the button.

It seems like UIStackView should always disregard itself as a hit target.


Version:
iOS 10.3

Notes:


Configuration:
iPhone 7 Simulator

Attachments:
'Untouchables.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!