'SwiftUI: Strange empty popover near TextField

Each time when I write character in TextField - displayed empty popover near the field.

enter image description here

It is displayed only on last MacOS/SwiftUI on few computers, but cannot be reproduced on older OS/SwiftUI.

Reproduced on:

macOS: 12.2 (21D49) + 12.2.1

xCode: 13.2.1 (13C100)

Looks like it does not reproduces on 12.2b

Anyone know how to fix it?

HStack {
    VStack(alignment: .trailing, spacing: 12) {
        Text("Username or email:")

        Text("Password:")
    }
    
    VStack {
        // REPRODUCED ONLY HERE
        TextField  ("Username or email",    text: $email)

        SecureField("Password", text: $password)
    }
    .frame(width: 190)
}
.padding(.bottom, 15)

Update:

  • It is can be reproduced on macOS 12.2.1

  • It opens "empty popup" with size of last opened context menu - if I click on password field it's opens passwords context menu and after this I will see:

enter image description here



Solution 1:[1]

I could reproduce this issue with macOS 12.3 and Xcode 13.3. Explicitly setting the NSTextContentType of the SecureField (via .textContentType(.password)) fixed it for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Quico Moya