Commit Graph

26 Commits

Author SHA1 Message Date
Bruno Pantaleão Gonçalves
56b5c6a20e Add keyboard avoidance and focused element scroll (#4486)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

Introduce keyboard handling for WKWebView: add WebViewKeyboardAvoidance
helpers for animation metrics and overlap calculation, a WKWebView
extension to run a JS command that scrolls the focused editable element
into view, and a managed bottom constraint for web views so the view is
animated above the keyboard. Wire up keyboard observers and
DispatchWorkItem scheduling/cleanup in WebViewController and
OnboardingAuthLoginViewController, and add the
scrollFocusedElementIntoView JavaScript to WebViewJavascriptCommands.
Add unit tests verifying the bottom constraint creation and JS contents.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-08 12:19:04 +02:00
Bruno Pantaleão Gonçalves
92214b873d Use explicit URL.port and remove fallback in SafeScriptMessageHandler (#4483)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

Remove the portWithFallback helper and update port comparisons to use
URL.port directly. baseIsEqual now compares ports via url.port (no
80/443 fallback), and SafeScriptMessageHandler passes url.port ?? 0 when
building origin keys (security origin uses port 0 when unspecified).
This simplifies port handling and avoids implicit defaulting to standard
ports.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-07 16:47:39 +02:00
Bruno Pantaleão Gonçalves
db00e3ad10 Prevent crash on call_service from deeplink (#4484)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-07 16:47:18 +02:00
Bruno Pantaleão Gonçalves
f5c416ac53 Avoid interrupting background audio when the frontend loads media-capable elements (#4482)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-07 14:35:12 +02:00
Bruno Pantaleão Gonçalves
034b8b3afa Validate script message origin (host:port) (#4470) 2026-04-02 22:21:04 +02:00
Bruno Pantaleão Gonçalves
c8f35e4cff Prevent execution of WKUserScript from beyond main frame and allowed hosts (#4469)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-02 13:52:29 +02:00
Bruno Pantaleão Gonçalves
a20ae2f593 Prevent unnecessary location access popup when https context (#4468)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-04-02 12:00:40 +02:00
Bruno Pantaleão Gonçalves
3227bd50fb Add condensed grid support to CarPlay templates (#4460) 2026-03-30 22:42:09 +02:00
Bruno Pantaleão Gonçalves
1f24517b54 Support opening iOS Assist settings from frontend (#4410)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-24 13:11:55 +01:00
Bruno Pantaleão Gonçalves
db92babda2 Remove JS return messages from web handler (#4447)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->
CC: @wendevlin 
## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-03-23 09:04:19 +00:00
nstefanelli
9ca16127c8 Fix kiosk screensaver idle timer not resetting on touch (#4434)
## Summary
- Kiosk screensaver idle timer was not resetting on user interaction —
`recordKioskActivity()` was defined but never called
- WKWebView consumes touch events before UIKit idle detection, so the
timer counted down from kiosk activation rather than last touch
- Added a tap gesture recognizer on the WebView (`cancelsTouchesInView =
false`) to detect taps without interfering with normal interaction
- Added `scrollViewWillBeginDragging` delegate hook to detect
scroll/drag interactions

## Test plan
- [ ] Enable kiosk mode with 30s screensaver timeout
- [ ] Tap on the WebView dashboard — idle timer should reset
- [ ] Scroll on the dashboard — idle timer should reset
- [ ] Stop interacting — screensaver should appear after configured
timeout
- [ ] Verify normal WebView interaction (taps, links, scrolling) still
works normally

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Nick Stefanelli <nstefanelli@users.noreply.github.com>
2026-03-23 09:28:44 +01:00
Wendelin
a5d59daa56 Fix using elementId in handleElementFocus script (#4442)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
- Fix home-assistant/frontend#30048
- elementId inside the JS was used in the return string, but not escaped
so JS fails.
- I am actually not sure if this return string is even needed. Does it
have any sense?

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
- when this is releases we activate again the functionality in the
frontend: home-assistant/frontend#30226
2026-03-23 09:23:55 +01:00
nstefanelli
31b2db4853 Add kiosk mode core infrastructure (PR 1/5) (#4422)
## Summary

Reopening kiosk mode PR (previously #4218) after addressing all review
feedback from @bgoncal. Apologies for the delay — some family matters
pulled me away, but I'm excited to get this implemented and am fully
committed to seeing it through.

This PR adds the foundational infrastructure for **kiosk mode** — a
feature designed for wall-mounted iPad displays running Home Assistant
dashboards.

### What's included:
- **KioskModeManager** — Central coordinator singleton with
KioskModeObserver protocol (no NotificationCenter)
- **KioskSettings** — Comprehensive settings model with GRDB persistence
(camelCase columns, Codable)
- **Screensaver system** — Clock screensaver with 4 styles, pixel shift
for OLED burn-in prevention
- **Secret exit gesture** — Configurable corner tap to access settings
when locked down
- **Status bar hiding** — StatusBarForwardingNavigationController for
proper UIKit integration
- **Settings UI** — SwiftUI settings accessible via Settings menu and
secret gesture
- **28 unit tests** — Covering settings serialization, time logic,
orientations, enums

### Changes since #4218 (all review feedback addressed):
-  Fixed settings modal dismissal on iOS 15 (UINavigationController +
explicit onDismiss closure)
-  Fixed status bar hiding (StatusBarForwardingNavigationController +
statusBarView integration)
-  Removed non-functional settings (navigationLockdown,
TouchFeedbackManager, IconMapper)
-  Replaced `Date()` with `Current.date()` for testability
-  GRDB persistence follows CarPlayConfig/WatchConfig pattern with
DatabaseTableProtocol
-  All strings localized via L10n (SwiftGen)
-  SFSafeSymbols used throughout (no string-based systemName)
-  KioskModeObserver protocol (no NotificationCenter)
-  Kiosk files prefixed with `Kiosk`
-  UIKit screensaver container (required for status bar/home indicator
control)
-  macCatalyst filtered out
-  Merged with latest upstream/main (adapted to Frontend/ directory
restructure)
-  Idle timer pauses when settings view is open
-  TODO comments (no PR-specific comments)

### Testing Instructions
1. **Settings → Companion App → Kiosk Mode** → Enable "Enable Kiosk
Mode"
2. Set screensaver timeout to **30 seconds** for quick testing
3. Wait for screensaver → tap to wake
4. Use secret gesture (default: 3 taps in top-left corner) to access
settings

### Previous review context
All feedback from @bgoncal in #4218 has been addressed. See that PR for
full discussion history.

## Test plan
- [ ] Enable/disable kiosk mode from Settings
- [ ] Screensaver activates after timeout
- [ ] Tap to wake from screensaver
- [ ] Secret gesture opens settings
- [ ] Status bar hides when kiosk mode active (full-screen iPad only)
- [ ] Device authentication toggle works
- [ ] Settings persist across app restart
- [ ] Clock screensaver styles (large, minimal, digital, analog)
- [ ] Pixel shift moves clock position periodically
- [ ] Kiosk entry hidden on macCatalyst

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Nick Stefanelli <nstefanelli@users.noreply.github.com>
2026-03-13 13:03:54 +00:00
Bruno Pantaleão Gonçalves
b2c6e87ccb Centralize app domains; adjust widget and intent (#4428)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Introduce HAAppUsedContent to centralize the list of Home Assistant
domains and provide rawValues. Use HAAppUsedContent.rawValues in
AppEntitiesModel to filter entities (removing the local domains list).
Update EntityAddToHandler to only add CustomWidgetAction when the
entity's Domain can be constructed and is included in
HAAppUsedContent.domains. Change MagicItem's default interactionType
from a refresh app intent to a navigateIntent that opens the entity deep
link (AppConstants.openEntityDeeplinkURL). These changes restrict widget
availability to supported domains and make default item interactions
navigate directly to the entity.
## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-03-10 14:57:43 +00:00
Bruno Pantaleão Gonçalves
78b47849eb Allow frontend to open native camera player through external bus (#4415)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-05 15:35:12 +01:00
Bruno Pantaleão Gonçalves
457bbb299e Remove "Native home view" experiment (#4406)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-03-04 10:46:03 +00:00
Bruno Pantaleão Gonçalves
a21ebf003b Refactor WebViewController (#4383)
Split WebViewController functionality into multiple extension files
(Alerts, EmptyState, Gestures, Navigation, Onboarding, Settings,
StatusBar, URLLoading, WebViewSetup) and add FrontEndConnectionState
enum. Update Xcode project to include the new source files and adjust
several Database test file references and a local Swift package path
(Sources/SharedPush). Also add empty input/output path arrays to several
CocoaPods embed phases. This refactors web view features into modular
components and wires them into the project file.

<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-02-23 11:57:56 +01:00
Copilot
5d88cf34cc Fix: DownloadManagerView traps window on Mac Catalyst with no dismiss path (#4379)
On Mac Catalyst, downloading the emergency kit backup presented
`DownloadManagerView` with 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 a `CloseButton` as
leading toolbar item when `Current.isCatalyst`, using the existing
`.modify` pattern
- **`WebViewController+WebKitDelegates`** — wraps the
`UIHostingController` in a `UINavigationController` on Mac Catalyst so
the toolbar is rendered

```swift
// WebViewController+WebKitDelegates.swift
if Current.isCatalyst {
    let navigationController = UINavigationController(rootViewController: downloadController)
    presentOverlayController(controller: navigationController, animated: true)
} else {
    presentOverlayController(controller: downloadController, animated: true)
}
```

```swift
// DownloadManagerView.swift
.modify { view in
    if Current.isCatalyst {
        view.toolbar {
            ToolbarItem(placement: .topBarLeading) {
                CloseButton { dismiss() }
            }
        }
    } else {
        view
    }
}
```

Pattern mirrors the existing `WidgetSelectionView` Mac Catalyst handling
in `EntityAddToHandler`.

## 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.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Lost window control of HA app after downloading emergency
kit backup</issue_title>
> <issue_description><!-- Please READ THIS FIRST
> If your issue relates to something not looking right on Home Assistant
within the Companion App, please check if the error is present in Safari
on macOS too. If the issue is also seen in Safari, please open an issue
on the frontend repo
(https://github.com/home-assistant/frontend/issues/new?labels=bug&template=BUG_REPORT.md)
instead -->
> 
> **Device model, version and app version**
> <!-- Please include your mac's model and version as listed in 'About
This Mac'. Please also give the app version listed in the Home
Assistant>About Home Assistant, please include the number in brackets.
Safari can be found by launching it in Safari > About Safari. -->
> 
> Model Name: M1 Pro MBP
> macOS Version: 15.7.4
> App Version: 2026.2.1
> Safari Version: n/a
> 
> **Home Assistant Core Version**
> <!-- Please give the version number of Home Assistant Core you are
running -->
> 2026.2.2
> 
> **Describe the bug**
> 
> Downloading the emergency kit through the macOS app results in the app
window staying continually on screen and being unable to click anywhere
else on screen to regain control of the app.
> 
> The app must be force closed via Activity Monitor to regain control of
the app.
> 
> **To Reproduce**
> 
> 1. Open macOS HA app.
> 2. Go to Settings, System, Backups, Settings and History, Download
emergency kit
> 
> **Expected behavior**
> 
> Window to close after the config is downloaded allowing the user to
control the app again.
> 
> **Screenshots**
> <!-- If applicable, add screenshots to help explain your problem. -->
> 
> <img width="692" height="716" alt="Image"
src="https://github.com/user-attachments/assets/0807b43a-5f6c-4651-bbdd-7ff0daf72e94"
/>
> 
> **Additional context**
> <!--Add any other context about the problem here.-->
> </issue_description>
> 
> <agent_instructions>When presenting the DownloadManagerView on Mac
Catalyst we can’t rely on presentation defender and gesture to dismiss,
we need a navigation view with a “CloseButton” as leading toolbar
item</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes home-assistant/iOS#4378

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 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.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
2026-02-23 10:20:26 +00:00
Copilot
82bed24650 Fix widget builder dismissal on macOS Catalyst (#4370)
## Summary

macOS users cannot dismiss "Add to Widget" flows, requiring force quit.
`NavigationView`/`NavigationStack` missing
`.navigationViewStyle(.stack)` - required for Catalyst dismissal
controls (iOS uses gestures).

**Changed files:**
- `WidgetCreationView.swift` - Added `.stack` style to both
`NavigationStack` (iOS 16+) and `NavigationView` branches
- `WidgetSelectionView.swift` - Added `.stack` style to `NavigationView`

```swift
NavigationView {
    content
}
.navigationViewStyle(.stack)  // ← Enables dismissal controls on macOS
```

Pattern already established in `MagicItemAddView`, `AssistView`,
`SettingsView`, and 20+ other views.

## Screenshots

N/A - Fixes dismissal behavior only, no visual changes

## Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

## Any other notes

Agent instructions specified this exact fix. 3 lines added across 2
files.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Unable to Dismiss `Add to Widget` window</issue_title>
> <issue_description><!-- Please READ THIS FIRST
> If your issue relates to something not looking right on Home Assistant
within the Companion App, please check if the error is present in Safari
on macOS too. If the issue is also seen in Safari, please open an issue
on the frontend repo
(https://github.com/home-assistant/frontend/issues/new?labels=bug&template=BUG_REPORT.md)
instead -->
> 
> **Device model, version and app version**
> <!-- Please include your mac's model and version as listed in 'About
This Mac'. Please also give the app version listed in the Home
Assistant>About Home Assistant, please include the number in brackets.
Safari can be found by launching it in Safari > About Safari. -->
> 
> Model Name: MacBook M1
> macOS Version: 26.3
> App Version: 2026.2 (2026.2.1758)
> Safari Version: 26.3 (21623.2.7.11.6)
> 
> **Home Assistant Core Version**
> 2026.2.2
> 
> **Describe the bug**
> There doesn’t appear to be a way to dismiss the “Add to Widget” for
both windows using the macOS app. I have to force close the app to close
the window. This seems like an oversight as on iOS it uses gestures
which isn't supported here.
> 
> **To Reproduce**
> - Select Entity more-info
> - Click Add to Widget
> - See result
> 
> **Expected behavior**
> There should be a close button to get out of the window.
> **Screenshots**
> 
> <img width="732" height="934" alt="Image"
src="https://github.com/user-attachments/assets/12f28cc5-02c9-43ed-88c5-f96d386c17e3"
/>
> <img width="732" height="934" alt="Image"
src="https://github.com/user-attachments/assets/1c0b9b0e-600e-46db-94cf-15c1fbbec6d5"
/>
> 
> **Additional context**
> <!--Add any other context about the problem here.-->
> Unrelated, but I can't seem to be to delete the widgets on this screen
either.</issue_description>
> 
> <agent_instructions>When adding widget from mac catalyst webview, we
are opening the widget screen in a NavigationStack/NavigationView
without navigationViewStyle .stack defined, update
that</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes home-assistant/iOS#4369

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
2026-02-19 10:03:55 +00:00
Bruno Pantaleão Gonçalves
65316f2602 Check connection state before auto reload webview (#4364)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Recently it was introduced a feature to reload webview when app has been
backgrounded for more than 5 minutes, this PR adds a layer on top of it
that only reloads if the webview frontend connection state is not
connected.


## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-18 11:13:20 +01:00
Bruno Pantaleão Gonçalves
fdb0e2bc03 Todo list widget (#4347) 2026-02-12 23:40:14 +01:00
Bruno Pantaleão Gonçalves
2120ef8b79 Add extra padding to DownloadManagerView (#4337) 2026-02-10 21:39:09 +01:00
Bruno Pantaleão Gonçalves
c29e9409f3 Fix crash on iOS 15/16 due to @Observable in PassThroughWindow (#4334)
Replace @Observable macro with ObservableObject pattern to fix crash
during app launch on iOS 15-16 devices.

Root cause:
- PassThroughWindow used @Observable macro (iOS 17+ API)
- Despite @available(iOS 18, *), Swift compiled metadata into binary
- During app launch, Realm's objc_copyClassList() triggered metadata
loading for all classes
- @Observable generated code referenced symbols unavailable on iOS 15/16
- Result: null pointer dereference crash at startup

The fix:
- Replace @Observable with ObservableObject + @Published properties
- These patterns work on iOS 13+, safe for iOS 15/16
- No behavioral changes, same observation mechanism
- Maintains @available(iOS 18, *) for class usage

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 23:34:35 +00:00
Bruno Pantaleão Gonçalves
82e1ce3daa Use NavigationStack for settings starting on iOS 16 (#4330)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2026-02-09 15:40:17 +01:00
Bruno Pantaleão Gonçalves
120df2a204 Skip sync on Catalyst for load/refresh (#4325)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Extracted load/refresh blocks and conditionally invoke
Current.connectivity.syncNetworkInformation only on non-Catalyst
targets. On Catalyst the closures are executed immediately to avoid
unnecessary async network syncs and ensure immediate UI behavior.
Applied to WebViewController and its protocol conformance refresh
handling.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-02-08 15:07:54 +00:00
Bruno Pantaleão Gonçalves
e17f81f64b Organize webview folder (#4324)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-02-08 15:18:43 +01:00