Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Clicking on the post list text, the NavigationLink isn't triggered #9

Closed
SirArkimedes opened this issue Oct 19, 2019 · 3 comments · Fixed by #16
Closed

[macOS] Clicking on the post list text, the NavigationLink isn't triggered #9

SirArkimedes opened this issue Oct 19, 2019 · 3 comments · Fixed by #16
Labels
bug Something isn't working

Comments

@SirArkimedes
Copy link
Contributor

What happens:
When clicking on any of the text, or elements, that are in the List on macOS, the NavigationLink destination isn't triggered.

An example:
When clicking on the text that is enclosed within the red box,
macOS
The PostDetailView destination does not get triggered.
The only way to trigger the PostDetailView is to click outside of the Text elements.

Additional details:
Removing the .onTapGesture(count: 2) from macOS' PostView will allow the clicks to be passed through again. Though, this obviously removes the double click to open a new window functionality.

@SirArkimedes SirArkimedes changed the title [macOS] Clicking on the post list text, or other elements, the NavigationLink isn't triggered [macOS] Clicking on the post list text, the NavigationLink isn't triggered Oct 19, 2019
@carson-katri carson-katri added the bug Something isn't working label Jan 9, 2020
@banaslee
Copy link
Contributor

banaslee commented Jun 2, 2020

Was looking at this issue since it was the first thing I noticed when trying the app out.
Tried .allowsHitTesting(false) on PostView and also ended up disabling the double tap.

I believe the NavigationLink is cancelling any other gesture but I was not able to prevent that.

This is my first look at SwiftUI, so I'm not sure it's even possible to reproduce the NavigationLink behaviour.

@banaslee
Copy link
Contributor

banaslee commented Jun 3, 2020

Actually, just discovered the double tap only works on top of the labels (where now the tap is not detected). Wanted to add that since I didn't see in the bug description.

banaslee added a commit to banaslee/reddit-swiftui that referenced this issue Jun 3, 2020
Quite a lot of changes in order to achieve this:
- had to activate the navigation link programmatically in order to capture single and double tap
- NavigationLink activated based on new view state for selected post tag
- moved the RequestView to the ContentView so the selected post wouldn't reload the whole PostList and retriever the request
- PostList now initialised with Listing object
- setting the contentShape of the PostView in the list in order to capture hits in the whole area, otherwise it would land on the NavigationLink behind
- adding two tap gestures in order of precedence
- set the default frame for the new spinner to guarantee a minimum size while loading

The only secondary effect from this solution I wasn't able to fix is that now cells don't get a selected state like before. I accept suggestions.
@banaslee
Copy link
Contributor

banaslee commented Jun 3, 2020

Gave it another try, went a bit deeper and I have a proposal. Only side effect is that cells now don't get a selected state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants