When placing a TextField within a RealityViewAttachment, the virtual keyboard does not appear in front of the user as expected.

Hello,

Thank you for your time. I have a question regarding visionOS app development.

When placing a SwiftUI TextField inside RealityView.attachments, we found that focusing on the field does not bring up the virtual keyboard in front of the user. Instead, the keyboard appears around the user’s lower abdomen area.

However, when placing the same TextField in a regular SwiftUI layer outside of RealityView, the keyboard appears in the correct position as expected. This suggests that the issue is specific to RealityView.attachments.

We are currently exploring ways to have the virtual keyboard appear directly in front of the user when using TextField inside RealityViewAttachments. If there is any method to explicitly control the keyboard position or any known workarounds—including alternative UI approaches—we would greatly appreciate your guidance.

Best regards,

Sadao Tokuyama

Boosting this one. Hopefully an Apple engineer can tell us if there is a workaround.

I've run into this too. In seems like visionOS places the keyboard relative to the host scene (a volume in my case) instead of near the attachment hosting the TextField.

Hello @sadaotokuyama and @radicalappdev,

This would be a great candidate for a feedback issue, please file at https://feedbackassistant.apple.com and post the FB number back here once filed.

In the mean time as a possible work around, can you use ViewAttachmentComponent instead? The new sample Canyon Crosser has several examples of using this new component.

When placing a TextField within a RealityViewAttachment, the virtual keyboard does not appear in front of the user as expected.
 
 
Q