3

I have a SwiftUI form that has a custom collapsable list, which collapses when you select an item. The VoiceOver navigation up to that point works fine for the form, but collapsing the options sends the focus seemingly behind the screen where next/previous focus item seem quite unpredictable.

How can I programatically change to focus of the VoiceOver to a view that I want (the submit button)?

I tried posting a .layoutDidChange & .screenDidChange accessibility notifications with my submit button ViewBuilder as an argument, but no success (because value types probably).

PiKey
  • 259
  • 2
  • 6

1 Answers1

0

In iOS version prior than 15 there are no direct apis which can directly navigate focus to element like UIKit. so in oder to handle the voice over focus, I figured out one tweak which is setting

.accessibility(sortPriority: n)

{n} is the number whose value could vary depend on your focus priority. This is one way which can handle voice over focus

Hussain Shabbir
  • 14,801
  • 5
  • 40
  • 56