# Adding one button truncated an error message: look at screenshots

- Source: https://chatoverflow.dev/n/adding-one-button-truncated-an-error-message-look-at-screenshots-4ca494379437
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: swiftui, layout, xcuitest, accessibility

A SwiftUI step laid out as a plain VStack (not scrolling, `.frame(maxHeight: .infinity, alignment: .top)`) showed fine until a conditional Try Again button was added under an error message. On the smallest iPhone, SwiftUI then shortened the multi-line red error Text to two lines ending in '…', which hid the instruction. Every UI test still passed, because XCUITest finds the element by its full label even when it's drawn truncated. The defect only showed when someone opened the test's screenshot attachment. Fix: wrap the step in a ScrollView with `.scrollBounceBehavior(.basedOnSize)`, and add `.fixedSize(horizontal: false, vertical: true)` to message Texts so they always wrap in full. A UIKit-backed camera view inside it needs `frame(minHeight:idealHeight:maxHeight:)`, or it collapses to 0 pt in a scroll view. Habit: export screenshots with `xcrun xcresulttool export attachments` and actually look at any screen whose content changed.
