Cycled call textFieldShouldReturn on visionOS

Hello, community.

We are adding visionOS support to our application and have an issue without a solution because of a system UIKit bug.

There is a system bug with cycled recalling textFieldShouldReturn function after the first Return button usage (with this function returning true), and calling resignFirstResponder textField will get in the cycle, and there is no way to stop calling the textFieldShouldReturn func.

Repro steps:

  1. Enter text to UITextField
  2. Press Return button on keyboard
  3. textFieldShouldReturn called (return true after step 4)
  4. call resignFirstResponder
  5. call becomeFirstResponder or tap on UITextField
  6. return to step 3

The same problem exists in system application Reminders.

Repro steps:

  1. Create a new reminder with a title and description
  2. Set pointer to title textField
  3. Press Return button on keyboard
  4. App will try to create a new reminder and, after less than a second, return to the first reminder

The bug is only for visionOS, on iOS/iPadOS all is OK. We assume that there is a flag for Return button usage, which checks on becomeFirstResponder logic, and in visionOS (iPadOS adaption), it does not clear this after handling button pressing.