cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
534 stars 65 forks source link

SwiftUI `TextEditor` bounding box does not render properly #202

Open DavidBrunow opened 5 months ago

DavidBrunow commented 5 months ago

Given this snapshot test:

    @available(iOS 14.0, *)
    func testTextEditor() {
        let textEditor = TextEditor(text: .constant(""))
            .frame(
                width: UIScreen.main.bounds.width,
                height: UIScreen.main.bounds.height
            )
            .border(Color.black)

        assertSnapshot(
            matching: textEditor,
            as: .accessibilityImage,
            named: nameForDevice()
        )
    }

The library renders this snapshot where the accessibility bounding box does not match the text editor's frame (note that the missing description for the Text Field is being worked in #186): testTextEditor 393x852-16-4-3x

This misrendering does not occur if the text editor is wrapped in a UIHostingController before calling assertSnapshot.