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

Floating Panel dismiss button #923

Open
rolson opened this issue Oct 23, 2024 · 9 comments
Open

Floating Panel dismiss button #923

rolson opened this issue Oct 23, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@rolson
Copy link
Contributor

rolson commented Oct 23, 2024

I'm not quite sure where the problem is here. If I add a close button to the floating panel with a utility network trace component, I get this which looks good some of the time:

image

But in some cases when the floating panel is collapsed, the close button is hidden:

image

Is there a better way to support the workflow where you want to dismiss the floating panel and cancel the trace?

@rolson rolson added the enhancement New feature or request label Oct 23, 2024
@mhdostal
Copy link
Member

The example does not allow closing the trace, but I can see the benefit in having a "Cancel" button, maybe alongside the "Trace" and "Clear All Results" buttons.

The "Clear All Results" button gets cut off in your second screen shot; the "Trace" button, prior to running a trace, does not; there must be a slight difference in how those two are handled.

@rolson
Copy link
Contributor Author

rolson commented Oct 23, 2024

It's not necessarily "cancel". But more like "Done" or "Close". And I don't know that it belongs in the trace component. I think it's the app developer to decide when and how to close it on devices like a phone where it's covering a lot of the real estate. I think this is more of a floating panel issue potentially. Or something odd in the way the floating panel and the trace component work together.

@dfeinzimer
Copy link
Collaborator

Coincidentally I received a question this morning from Kotlin about support for programatic trace starting points which got me thinking about a potential workaround for this in interim lieu of custom header support or a close button on the Floating Panel.

Replace UtilityNetworkTraceExampleView.swift with the attached version to try it.

UtilityNetworkTraceExampleView.swift.zip

Untitled.mov

@rolson
Copy link
Contributor Author

rolson commented Oct 23, 2024

I like that idea. In practice, this doesn't work that well. Maybe it's just a bug in the example code and could be fixed. Also, tapping "Add New" raises questions about what it should do in that case.

@dfeinzimer
Copy link
Collaborator

Also, tapping "Add New" raises questions about what it should do in that case.

Agreed, opened issue #925

@rolson
Copy link
Contributor Author

rolson commented Oct 23, 2024

I can't get the UNTrace component to work well in a floating panel when trying to add content (ie Title and Dismiss button) above it. These things just aren't quite playing nicely together. Is there a way to limit the floating panel detent to full and half? That could work for my scenario.

@dfeinzimer
Copy link
Collaborator

Is there a way to limit the floating panel detent to full and half? That could work for my scenario.

Not directly currently. I'd think monitoring (and programmatically setting when desired) the bound selectedDetent should work for that though.

@rolson
Copy link
Contributor Author

rolson commented Oct 23, 2024

I wonder if it would be good to have a built-in way to dismiss the floating panel. Since the drag bar is on the panel, maybe there should be some sort of option for a dismiss/close button. Also the panel has a binding to the isPresented, so it could easily set that to false.

@dfeinzimer
Copy link
Collaborator

I wonder if it would be good to have a built-in way to dismiss the floating panel.

I think this definitely makes sense to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants