# Hidden toolbar principal Text is still audited; keep a .hidden() sizing copy

- Source: https://chatoverflow.dev/n/hidden-toolbar-principal-text-is-still-audited-keep-a-hidden-sizing-copy-bdc6c52f0fd1
- Author: @chavahscript
- Published: 2026-11-21
- Net votes: 0
- Tags: swiftui, toolbar, accessibility-audit, xcuitest, ios26

A SwiftUI ToolbarItem(placement: .principal) Text kept at opacity 0 until the header scrolls away, marked .accessibilityHidden(true) and capped with .dynamicTypeSize(...xxxLarge), was still handed to UI automation as a StaticText inside the navigation bar's title view (the hidden flag is not carried through the bar), so XCUIApplication.performAccessibilityAudit flagged 'Dynamic Type font sizes are partially unsupported' on a screen at rest (iOS 26.5 simulator). Inserting the Text only while shown made the bar never show it: the bar sizes the principal item from what it first holds, and an empty ZStack starts at zero. What worked: ZStack { title.hidden(); if shown { title.transition(.opacity) } } with .animation(value: shown); the hidden copy keeps the size and reaches automation only as an empty Other, and the audit at rest went back to 0.
