Skip to content

fix(ha-panels): the builder's preview no longer crowds out the tile editors - #345

Merged
jherforth merged 1 commit into
mainfrom
fix/ha-builder-preview-layout
Oct 27, 2026
Merged

jherforth merged 1 commit into
mainfrom
fix/ha-builder-preview-layout

Conversation

@jherforth

Copy link
Copy Markdown
Owner

In the Home Assistant panel builder, choosing a Medium or Large preview made the tile editors too narrow to use.

Cause. The builder decided whether to put the preview beside the tile editors from the screen's width (MUI lg). Inside the Admin Panel, though, the builder itself is only about 745px wide. A Large preview (720px) placed beside the editors left them a sliver, too narrow to type in. Medium squeezed them as well.

Fix. The builder now lays out by its own width, measured with a ResizeObserver:

  • Placement. A new pure helper, previewLayout in haPanelBuilder.js, puts the preview beside the editors only when they still get at least 420px. Otherwise the preview goes above them. In the panel, Small sits beside the editors and Medium and Large sit above.
  • Scaling. The preview is drawn at the widget size it stands for. It is scaled down as a whole only when the builder is narrower than that, as on a phone. Tiles therefore wrap the way they will on the dashboard.
  • Tile editor fields. Label, Icon and Size, and the "Show only when" row, now wrap by the editor column's width through a container query, instead of by the screen's breakpoints.

Testing.

  • Unit tests cover previewLayout. The client suite passes (819/819) and the build is clean.
  • Edge, with Home Assistant mocked: 10/10 checks passed.
    • At each size, the preview is drawn at 300, 460 and 720px.
    • Small sits beside the editors; Medium and Large sit above them.
    • A tile label can be typed at every size.
    • On a 390px phone, Large scales to fit with no sideways scroll.
  • Server tests weren't run, since this change is client-only.

🤖 Generated with Claude Code

…ditors

The builder put its preview beside the tile editors from the screen's
width (lg), but inside the Admin Panel the builder is only about 745px
wide. A Large preview (720px) beside the editors left them a sliver, too
narrow to type in, and Medium squeezed them too.

The builder now lays out by its own width, measured with a
ResizeObserver: the preview goes beside the editors only when they keep
at least 420px (previewLayout), else above them. It is drawn at the
widget size it stands for, and scaled as a whole only when the builder is
narrower than that (a phone), so tiles wrap as on the dashboard. A tile
editor's fields, and its "Show only when" row, wrap by the editors' width
through a container query, not the screen's breakpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jherforth
jherforth merged commit d0ff730 into main Oct 27, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in HomeGlow Kanban Oct 27, 2026
@jherforth jherforth self-assigned this Oct 27, 2026
@jherforth jherforth added the bug Something isn't working label Oct 27, 2026
@jherforth jherforth added this to the 1.11 milestone Oct 27, 2026
adamecker pushed a commit to adamecker/HomeGlow that referenced this pull request Oct 27, 2026
@jherforth
jherforth deleted the fix/ha-builder-preview-layout branch October 28, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant