Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Summary

On macOS Catalyst, the save button in widget item customization becomes a thin vertical line and non-functional. The toolbar button lacked explicit ToolbarItem placement, causing macOS Catalyst rendering issues.

Before:

.toolbar {
    Button {
        save()
        dismiss()
    } label: {
        Text(mode == .add ? L10n.MagicItem.add : L10n.MagicItem.edit)
    }
}

After:

.toolbar {
    ToolbarItem(placement: .topBarTrailing) {
        Button {
            save()
            dismiss()
        } label: {
            Text(mode == .add ? L10n.MagicItem.add : L10n.MagicItem.edit)
        }
    }
}

Screenshots

N/A - This fix restores existing expected behavior on macOS Catalyst.

Link to pull request in Documentation repository

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

Any other notes

Aligns with toolbar patterns used in WidgetCreationView.swift and other views that work correctly on macOS Catalyst.

Original prompt

This section details on the original issue you should resolve

<issue_title>macOS Custom Widget Beta: widget item updates not saving</issue_title>
<issue_description>Model Name: iMac 24-inch, 2023 Apple M3
macOS Version: Tahoe 26.1
App Version: 2025.11.2 (2025.1537)
Safari Version: 26.1

Home Assistant Core Version 25.12.1

Describe the bug
In the Custom Widget Beta, after saving an update of an existing item in an existing widget eg changing custom colours or actions, the next screen where the widget should save via a top right save button turns into a long thin vertical button that does not appear to allow saving. Item change in existing widgets will then not save.

To Reproduce
Establish a new widget with (say) two new items and save it. Go back into the widget, click on one of the items and change the colours or action, and save the change. The resulting screen will not show a top right button to save the updated widget, and the changes to the item will be lost.

Expected behavior
After making the change to the item and saving that change, the widget should also then be saved presumably to preserve all changes that may have been made to multiple items.

Screenshots

Widget "Test" created and ready to save:

Image

Basement Occupancy then adjusted to custom colours and is ready to save:

Image

After saving the updated Basement Occupancy item the save widget button that should be in the top left screen goes missing:

Image

Going back out to the front screen (as that is the only option) and back into the widget, the custom colour has not saved:

Image

Additional context
The iOS custom widget beta does not seem to have this issue - only on the macOS companion app.
</issue_description>

<agent_instructions>Apparently when building for macOS catalyst, when user tries to save widget in the widget builder that have in the app, the save button does not work, the save text from inside the button vanishes and just a small empty and functionless button is displayed instead</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@bgoncal Please reopen the issue providing the information requested in the issue report template.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…Catalyst

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix widget item updates not saving in custom widget beta Fix macOS Catalyst toolbar button rendering in widget item customization Dec 15, 2025
Copilot AI requested a review from bgoncal December 15, 2025 14:12
@bgoncal bgoncal marked this pull request as ready for review December 15, 2025 14:25
Copilot AI review requested due to automatic review settings December 15, 2025 14:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a macOS Catalyst-specific rendering issue where the save button in widget item customization becomes non-functional and renders as a thin vertical line. The fix wraps the button in an explicit ToolbarItem with .topBarTrailing placement, aligning with the established pattern used throughout the codebase.

  • Adds explicit ToolbarItem(placement: .topBarTrailing) wrapper to the save button in MagicItemCustomizationView
  • Ensures consistent toolbar button rendering across all platforms (iOS, macOS Catalyst)
  • Aligns with the pattern already used in related views like WidgetCreationView, AssistPipelinePicker, IconPicker, and EntityPicker

@bgoncal bgoncal enabled auto-merge (squash) December 15, 2025 14:31
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@35c6562). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4092   +/-   ##
=======================================
  Coverage        ?   45.59%           
=======================================
  Files           ?      242           
  Lines           ?    13664           
  Branches        ?        0           
=======================================
  Hits            ?     6230           
  Misses          ?     7434           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bgoncal bgoncal merged commit 4fd4302 into main Dec 15, 2025
22 of 23 checks passed
@bgoncal bgoncal deleted the copilot/fix-widget-item-updates branch December 15, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS Custom Widget Beta: widget item updates not saving

2 participants