Application Hangs with Nested LazyVStack When Accessibility Inspector is Active

Description

I've encountered a consistent hang/freeze issue in SwiftUI applications when using nested LazyVStack containers with Accessibility Inspector (simulator) or VoiceOver (physical device) enabled. The application becomes completely unresponsive and must be force-quit.

Importantly, this hang occurs in a minimal SwiftUI project with no third-party dependencies, suggesting this is a framework-level issue with the interaction between SwiftUI's lazy view lifecycle and the accessibility system.

Reproduction Steps

I've created a minimal reproduction project available here: https://github.com/pendo-io/SwiftUI_Hang_Reproduction

To Reproduce:

  1. Create a SwiftUI view with the following nested LazyVStack structure:
struct NestedLazyVStackView: View {
    @State private var outerSections: [Int] = []
    @State private var innerRows: [Int: [Int]] = [:]
    
    var body: some View {
        ScrollView {
            LazyVStack(alignment: .leading, spacing: 24) {
                ForEach(outerSections, id: \.self) { section in
                    VStack(alignment: .leading, spacing: 8) {
                        Text("Section #\(section)")
                        
                        // Nested LazyVStack
                        LazyVStack(alignment: .leading, spacing: 2) {
                            ForEach(innerRows[section] ?? [], id: \.self) { row in
                                Text("Section #\(section) - Row #\(row)")
                                    .onAppear {
                                        // Load more data when row appears
                                        loadMoreInner(section: section)
                                    }
                            }
                        }
                    }
                    .onAppear {
                        // Load more sections when section appears
                        loadMoreOuter()
                    }
                }
            }
        }
    }
}
  1. Enable Accessibility Inspector in iOS Simulator:

    • Xcode → Open Developer Tool → Accessibility Inspector
    • Select your running simulator
    • Enable Inspection mode (eye icon)
  2. Navigate to the view and start scrolling

  3. Result: The application hangs and becomes unresponsive within a few seconds of scrolling

Expected Behavior

The application should remain responsive when Accessibility Inspector or VoiceOver is enabled, allowing users to scroll through nested lazy containers without freezing.

Actual Behavior

  • The application freezes/hangs completely
  • CPU usage may spike
  • The app must be force-quit to recover
  • The hang occurs consistently and is reproducible

Workaround 1: Replace inner LazyVStack with VStack

LazyVStack {
    ForEach(...) { section in
        VStack {  // ← Changed from LazyVStack
            ForEach(...) { row in
                ...
            }
        }
    }
}

Workaround 2: Embed in TabView

TabView {
    NavigationStack {
        NestedLazyVStackView()  // ← Same nested structure, but no hang
    }
    .tabItem { ... }
}

Interestingly, wrapping the entire navigation stack in a TabView prevents the hang entirely, even with the nested LazyVStack structure intact.

Questions for Apple

  1. Is there a known issue with nested LazyVStack containers and accessibility traversal?
  2. Why does wrapping the view in a TabView prevent the hang?
  3. Are there recommended patterns for using nested lazy containers with accessibility support?
  4. Is this a timing issue, a deadlock, or an infinite loop in the accessibility system?
  5. Why that happens?

Reproduction Project

A complete, minimal reproduction project is available at: https://github.com/pendo-io/SwiftUI_Hang_Reproduction

Hello @mike sldkcjnsdmhvbsdh

Thank you for documenting and providing workarounds.

I am able to reproduce this issue and would like you to file a Bug Report. After that, please reply with the FB number in this thread. I will make sure it is seen by the relevant engineering team.

In the report, I recommend sending the project as an attachment, we often look for attachments, and feel free to also include the GitHub link as your documentation is beyond helpful to us in our investigation and others who may run into this issue.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

Thank you!

 Travis Trotto - DTS Engineer

@DTS Engineer

We have just submitted: FB21851974

Thanks

@DTS Engineer

Any minimal insight you can share or how to avoid it ?

Hello @mike sldkcjnsdmhvbsdh

I can see the code you submitted and have some insight. However, I am not the engineering team handling this report and would continue to refer to the status and discussion in Feedback Assistant, but I do have some insight.

See your line 40 of NestedLazyVStackView

.onAppear {
   // ⚠️ HANG TRIGGER POINT

LazyVStacks allocates views as they are needed and here SwiftUI is modifying its content through state changes while that is happening.

This creates a race condition.

Traversing the accessibility tree will cause unexpected issues in this situation.

For more info on the best practices building performant layouts, see:

Building layouts with stack views and Creating performant scrollable stacks

I hope this helps!  Travis Trotto - DTS Engineer

@DTS Engineer I have noticed the crash happens only on ios 26+. Previous ios versions were not affected. Can we confirm it? It seems like regression bug in that case

Hey @DTS Engineer Is there any chance this has been resolved on iOS 26.5? Thanks.

Do you have an updated project to share that reproduces the crash?

When I run your submitted project on the latest iOS 27 beta, the app runs as it did before. I haven't been able to replicate a crash if that helps.

Note, the race condition is still present in this project and it would be best to isolate issue before evaluating performance.

Recently, an entire session on lazy containers was shared at WWDC26. See Dive into lazy stacks and scrolling with SwiftUI, the goal of this session was a deep dive into lazy stacks as well as clarify best practices.

Feel free to share an update on your project here and let me know what steps you do to reproduce a crash.

Also, updates on feedback reports are provided through Feedback Assistant – so feel free to keep checking there and use this post to update us on what you find.

 Travis

Hey Travis @DTS Engineer, Im not able to add video in here, But if you navigate (in the shared app) to the lazy stack and scroll down as much as possible, with voice over on, You will see that until 26.5 the app has hang and crash. Take for example iOS 26.2 Simulator and do as I described and you will be able to see it right away. We were just curious if this has been resolved at 26.5 as we can reproduce this anymore since then.

Thank you! Lorin

Application Hangs with Nested LazyVStack When Accessibility Inspector is Active
 
 
Q