Repository navigation
Conversation
The permissions steps are not on a navigation stack, so a choice could not be revised: after picking the most secure local access, the home network step could only be left by entering a network name. Show a back button in the navigation bar from the second step on. Where the flow is opened from the app with a close button, that button moves to the trailing edge.
A save that settles after the user went back from the home network step no longer marks the step as done.
2 of 4 tasks
Earlier steps have side effects going back would not undo, such as registering sensors for an additional server. The button now sits in the step content, so the page's navigation bar and the close button of the permissions cover stay as they were.
bgoncal
pushed a commit
that referenced
this pull request
Oct 15, 2026
<!-- 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. --> ## AI Policy <!-- Please read our AI policy before contributing: https://developers.home-assistant.io/docs/ai_policy --> - [x] I have read the [Open Home Foundation AI Policy](https://developers.home-assistant.io/docs/ai_policy). Select exactly one option that describes AI usage in this contribution: - [ ] I have not used AI for this contribution. - [ ] AI assistance was used for this contribution. - [x] AI fully generated the code for this contribution, but I've reviewed and understood it before submitting and will respond without AI during review. ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> The device name screen has had no way out since #5178. If saving keeps failing, the app has to be killed. - Adds a Cancel button. - A failure before the server is saved no longer waits for the token revocation and no longer deletes an existing server with the same instance ID. Tested in the simulator, including the invitation flow. ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> Device name https://github.com/user-attachments/assets/c24ff71c-ced5-45c7-a1ac-38a5f70787ed Invitation https://github.com/user-attachments/assets/aa5cc46c-318f-415f-aa2f-a75e10c90078 Second server https://github.com/user-attachments/assets/df1b5586-845c-4a7a-9fbc-229369834ac1 ## 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. --> Permissions back button: #6071. Android already has a back button here.
Going back now restores the security level from before Most secure, and pages slide out in the direction they are left in.
6 of 8 tasks
The direction is view state now, set before the page being left is removed. Back needs the local access choice before the home network step, and a location grant that arrives after going back no longer moves the flow on. The tests no longer share the global location permission.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A pending Wi-Fi success flag can undo Back navigation and prevent subsequent saves from advancing.
1 open issue
What changed in this PR
Adds a Back button to onboarding’s home-network step so users can revisit their connection security choice.
Changes:
- Restores the previous security level on Back and guards late callbacks.
- Updates navigation-bar visibility and transition direction.
- Adds localized text and back-navigation test coverage.
| File | Description |
|---|---|
| Tests/UI/OnboardingE2ETests.swift | Exercises Back and forward navigation. |
| Tests/App/Onboarding/OnboardingPermissionsNavigationViewModelTests.swift | Tests restoration, callback handling, and Back availability. |
| Sources/Shared/Resources/Swiftgen/Strings.swift | Adds the generated Back accessor. |
| Sources/App/Resources/en.lproj/Localizable.strings | Adds the English Back label. |
| Sources/App/Onboarding/Steps/Permissions/OnboardingPermissionsNavigationViewModel.swift | Implements Back and callback guards. |
| Sources/App/Onboarding/Steps/Permissions/OnboardingPermissionsNavigationView.swift | Adds the button and directional transitions. |
| Sources/App/Onboarding/Container/OnboardingNavigationView.swift | Enables conditional navigation-bar visibility. |
| Sources/App/Accessibility/AccessibilityIdentifier.swift | Adds the Back button’s test identifier. |
Review effort: Balanced
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (76.59%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6071 +/- ##
=======================================
Coverage 56.11% 56.11%
=======================================
Files 1256 1256
Lines 83431 83465 +34
=======================================
+ Hits 46819 46839 +20
- Misses 36612 36626 +14
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.

AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
After "Most secure", the home network step had no way back. It now has a Back button in the navigation bar, on this step only. Going back restores the previous security level; a location grant or Wi-Fi save arriving afterwards no longer moves the flow on.
The back transition needed a fix: a removed view animates with its last render, so the page being left is redrawn with the back direction first. The direction now lives in the view.
Android counterpart: home-assistant/android#7642. Android keeps "Most secure" selected instead of restoring the level.
Flow map
flowchart TD A([Onboarding]) -->|no remote access set up| DIS[Local-only disclaimer] A -->|remote access set up| LOC DIS --> LOC["Location (first server)<br/>Privacy choices (added server)"] LOC -->|server has an HTTPS URL| DONE([Done]) LOC -->|HTTP URLs only| LA[Local access] W([Frontend, HTTP-only server]) -->|location not decided| LOC2[Location] W -->|security level not decided| LA LOC2 --> LA LA -->|Less secure| DONE LA -->|Most secure, location denied| LA LA -->|Most secure, location allowed| HN[Home network] HN -->|Wi-Fi name saved| DONE HN ==>|"Back (this PR)"| LA linkStyle 12 stroke:#03a9f4,stroke-width:3pxTested
Simulator, result checked in the server settings. The new unit tests fail without their change. The E2E test now goes back once, green in light and dark.
Screenshots
Back and forward again, light:
ios-back-light.mp4
Dark:
ios-back-dark.mp4
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
Split from #6067.