Skip to content

fix(editor): size the query error banner to its message instead of a fixed height#1834

Merged
datlechin merged 1 commit into
mainfrom
fix/error-banner-sizes-to-content
Jul 8, 2026
Merged

fix(editor): size the query error banner to its message instead of a fixed height#1834
datlechin merged 1 commit into
mainfrom
fix/error-banner-sizes-to-content

Conversation

@datlechin

@datlechin datlechin commented Jul 8, 2026

Copy link
Copy Markdown
Member

Problem

The inline query error banner rendered a large fixed-height block even for a one-line error, with a lot of empty space below the message.

Root cause

InlineErrorBanner wrapped the message in ScrollView { Text }.frame(maxHeight: 96). A SwiftUI ScrollView is greedy along its scroll axis: given a proposed height it takes all of it, so .frame(maxHeight: 96) made the banner 96pt tall regardless of the message length.

Fix

Stop letting the ScrollView own the height. Measure the message height and give the scroll view an explicit .frame(height: min(measured, 96)), disable scrolling when the message fits, and add .scrollBounceBehavior(.basedOnSize):

  • A short error is a single-line banner.
  • A long error caps at 96pt and scrolls.

The height is measured with onGeometryChange(for:of:action:), the same API already used in QuickSwitcherPanel. It is available on macOS 13+ (the app targets macOS 14). Text selection, the copy button, Fix with AI, and dismiss are unchanged.

This matches Apple's HIG guidance to keep inline error banners compact and sized to content, and avoids the fragile ViewThatFits and an AppKit bridge.

Testing

I can't build the app in this environment, so please build and confirm. The #Preview in the file now shows both a short (one-line) and a long (scrolling) error so the behavior is visible in Xcode previews.

Files

  • TablePro/Views/Results/InlineErrorBanner.swift: measure-and-clamp height.
  • CHANGELOG.md: folded into the existing unreleased banner entry (the banner shipped in the same unreleased cycle).

@datlechin datlechin merged commit 5227b7c into main Jul 8, 2026
2 checks passed
@datlechin datlechin deleted the fix/error-banner-sizes-to-content branch July 8, 2026 15:30
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.

1 participant