fix(editor): size the query error banner to its message instead of a fixed height#1834
Merged
Merged
Conversation
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.
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
InlineErrorBannerwrapped the message inScrollView { Text }.frame(maxHeight: 96). A SwiftUIScrollViewis 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
ScrollViewown 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):The height is measured with
onGeometryChange(for:of:action:), the same API already used inQuickSwitcherPanel. 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
ViewThatFitsand an AppKit bridge.Testing
I can't build the app in this environment, so please build and confirm. The
#Previewin 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).