Fix: DownloadManagerView traps window on Mac Catalyst with no dismiss path#4379
Merged
Fix: DownloadManagerView traps window on Mac Catalyst with no dismiss path#4379
Conversation
On Mac Catalyst, users were unable to dismiss the DownloadManagerView after downloading the emergency kit because there's no swipe-to-dismiss gesture. Fix by adding a CloseButton as leading toolbar item via a NavigationController wrapper when on Mac Catalyst. Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix lost window control in HA app after emergency kit backup
Fix: DownloadManagerView traps window on Mac Catalyst with no dismiss path
Feb 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4379 +/- ##
=======================================
Coverage ? 42.95%
=======================================
Files ? 262
Lines ? 15182
Branches ? 0
=======================================
Hits ? 6522
Misses ? 8660
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Mac Catalyst-specific UX trap where DownloadManagerView could be presented without any dismiss path, leaving the app window effectively stuck after downloading the emergency kit.
Changes:
- Adds a Mac Catalyst-only leading toolbar
CloseButtontoDownloadManagerView. - Wraps the
UIHostingControllerin aUINavigationControlleron Mac Catalyst so the toolbar/navigation bar is rendered.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/App/Frontend/WebView/WebViewController+WebKitDelegates.swift | Presents the download manager inside a UINavigationController on Mac Catalyst to enable a visible navigation bar/toolbar. |
| Sources/App/Frontend/DownloadManager/DownloadManagerView.swift | Adds a Catalyst-only close affordance via a leading toolbar item that calls dismiss(). |
Wrap the DownloadManagerView in a NavigationView and always attach the CloseButton toolbar (use .navigationViewStyle(.stack) for consistent behavior). Remove the previous platform-specific view.modify conditional for Catalyst. Simplify presentation in WebViewController by removing the special-case UINavigationController wrapper and present the UIHostingController directly. These changes unify the download UI and simplify presentation logic across platforms.
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.
On Mac Catalyst, downloading the emergency kit backup presented
DownloadManagerViewwith no way to dismiss it — no swipe gesture, no close button — requiring a force-quit to recover the window.Mac Catalyst has no sheet swipe-to-dismiss, so the view needs an explicit close affordance via a navigation bar.
Changes
DownloadManagerView— conditionally adds aCloseButtonas leading toolbar item whenCurrent.isCatalyst, using the existing.modifypatternWebViewController+WebKitDelegates— wraps theUIHostingControllerin aUINavigationControlleron Mac Catalyst so the toolbar is renderedPattern mirrors the existing
WidgetSelectionViewMac Catalyst handling inEntityAddToHandler.Screenshots
Before: "Download finished" overlay with no dismiss control, app window unresponsive until force-quit.
After: Navigation bar with close button allows dismissal normally.
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
No documentation change needed — no user-visible feature added, only a broken interaction fixed.
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.