What is "focus"?

In iOS 15 SDK you added the new FocusState API in SwiftUI. However there is no discussion or explanation anywhere that I could find, which explains:

  • What exactly is "focus"?
  • What isn't focus?
  • What is the relationship between FocusState and accessibility focus?
  • What is the relationship between whether a SecureField is being edited, and whether it's "focused"?

Example:

Lets say my tvOS app has an on-screen keyboard, where the user uses the remote's directional controls to move focus around to the letter buttons. To enter their password, they focus the password field, then click the center button to activate it. Now that it's active, they move focus to each letter of their password and click on each one: P... A... S... S... W... R... D... !... then they move focus to the "Submit" button and click.

In this case, while the SecureField is being edited, focus moves around to a bunch of different buttons.

The point of this example is that, if SecureField had a public "isBeingEdited" property, then it would be TRUE even while the field is not focused.

However most Workday's designers interpret "focused" as being totally equivalent to "isBeingEdited" because in a web browser, tabbing out of a field makes it stop being edited.

What is Apple's intent here? When not using a remote or physical keyboard or screen-reader, how is focus supposed to relate to whether a field is being edited? Does this relationship change when a user now has a bluetooth keyboard connected and Full Keyboard Access is turned ON? How does this correlate with accessibility focus?

I cannot find any documentation from Apple that explains what focus is, or how this is supposed to work in SwiftUI in the various different scenarios where the concept of "focus" is relevant. Do you have a link to something current that explains how it's supposed to work so that we will know if there's a bug?

Last question: how can we make the iOS simulator treat the physical keyboard as if it was a bluetooth keyboard to be used for focus-based keyboard navigation?

Note: I did find this discussion of the five "focusable states" in tvOS but this doesn't tell me which of these states "isBeingEdited" (if it existed for SecureField, which it doesn't) should correspond to if we're talking about iOS instead of tvOS. https://developer.apple.com/design/human-interface-guidelines/tvos/app-architecture/focus-and-selection/

You must be a teacher with your own opinions already cemented. The documentation is very clear and provides examples. Stop fighting the system and follow the examples, perform actual test, and assess the results instead of fighting those providing the answers to your somewhat rant list of questions. As some will say, Read The ******* Manual.

You must be a teacher with your own opinions already cemented. The documentation is very clear and provides examples. Stop fighting the system and follow the examples, perform actual test, and assess the results instead of fighting those providing the answers to your somewhat rant list of questions. As some will say, Read The ******* Manual.

Look, I am just asking these simple questions:

  • What exactly is "focus"?
  • What isn't focus?
  • What is the relationship between FocusState and accessibility focus?
  • What is the relationship between whether a SecureField is being edited, and whether it's "focused"?

If you know the answer, even if you're just copy-pasting it from somewhere else, please leave it as a response to this post, and if it's correct then I'll mark it correct.

But please don't just reply and accuse me of being a teacher, because (a) I'm not a teacher, and (b) the documentation does not define what focus means, exactly, or whether it always directly corresponds with what's being edited, or not.

I'm not fighting any systems; I just want to know the answer to these simple questions. Performing tests on devices or simulators won't tell me how it's supposed to work. Thanks.

SwiftUI focus doesn't make any sense to me either. I'm just trying to have keys route properly on a NavigationSplitView. The detail view is a WKWebView and can respond to most keys, but then the list items don't advance off up/down arrow. And the web pages cmd+S (search) doesn't work if the listView is the focus. So the whole firstReponder model really doesn't work. I'm happy to always focus the WKWebView, but then I need the arrows to advance the list without the error "bonk".

What is "focus"?
 
 
Q