Fix power toggle gesture conflict on iOS 16#81
Merged
Moustachauve merged 4 commits intomainfrom Apr 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds an empty .onTapGesture handler to the Toggle component in DeviceListItemView to prevent gesture conflicts on iOS 16. The reviewer suggests applying this same workaround to the Slider component to ensure consistent behavior and prevent accidental navigation when adjusting settings.
- Make backgroundDisconnectDelay injectable so tests use milliseconds instead of multi-second wall-clock sleeps - Pipe xcodebuild through xcbeautify for readable CI logs - Generate JUnit XML report for test results
- Make backgroundDisconnectDelay injectable so tests use milliseconds instead of multi-second wall-clock sleeps - Pipe xcodebuild through xcbeautify for readable CI logs - Generate JUnit XML report for test results
…uve/WLED-iOS into fix-power-toggle-opens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ Fix: Power Toggle Gesture Conflict on iOS 16
This fixes #73
📝 Summary
This PR fixes a bug on iOS 16 where tapping a device's power toggle in the list would simultaneously open the device detail view.
On iOS 16, SwiftUI's
.onTapGestureon a parent (the List row) is too "greedy" and triggers even when a child interactive control like aToggleis tapped. This resulted in the app toggling the power and navigating to the detail screen at the same time.💡 The Solution
Added an empty
.onTapGesture { }specifically to the childToggle. SwiftUI's gesture system prioritizes the child's (more specific) gesture recognizer. This empty handler "claims" the tap, preventing it from bubbling up to the parent row. Because theToggleuses UIKit'sUISwitchunder the hood, it still correctly receives the touch event via UIKit and functions normally.✅ Verified