UIButton starts out focused but can't navigate back to it

I'm an experienced iOS developer but new to tvOS, and I'm finding the focus engine to be somewhat confounding.

My app launches with a UINavigationController, whose root view is a UITableViewController. When I select a row, a UIViewController is pushed.

That view controller contains a bunch of nested UICollectionViews. One of the collection view cells contains 3 UIButtons. When the view first appears, the first of those (Button1) has focus.

I can move focus from Button1 to Button2, and from Button2 to Button3. I can also go back from Button3 to Button2. But I cannot navigate back to Button1, and I'm trying to figure out why.

I have focus logging turned on. It's very verbose, but here are the parts that seem useful to me:

When the view controller displays initially, I see

Updating focus from <UITableViewCell: 0x104841a00> to <DXETV.CustomButton: 0x104232610> in focus system <UIFocusSystem: 0x60000370c900>.

The result of the focus update was determined from the following preferred focus search:
|
|	Starting preferred focus search.
|	<UINavigationController: 0x10600f000>
|	 └ <DXETV.RenderExampleViewController: 0x10484ae00>
|	    └ <DXETV.RenderExampleView: 0x10421ab70>
|	       └ <DXETV.LayoutElementView: 0x107021000>
|	          └ <DXETV.LayoutCollectionView: 0x10707d200>
|	             └ <DXETV.LayoutViewCell: 0x10681ee00>
|	                └ <DXETV.LayoutElementView: 0x106862000>
|	                   └ <DXETV.LayoutCollectionView: 0x106865a00>
|	                      └ <DXETV.LayoutViewCell: 0x106851000>
|	                         └ <DXETV.LayoutElementView: 0x104891800>
|	                            └ <DXETV.LayoutCollectionView: 0x10488da00>
|	                               └ <DXETV.LayoutViewCell: 0x1048de600>
|	                                  └ <DXETV.CustomButton: 0x104232610>
|	                                       (info) It's focusable!
|

This seems right... focus moves from the table view cell to Button1, and this is he view hierarchy I expect.

Then we see

Creating focus scroll animator entry for environment <DXETV.LayoutCollectionView: 0x10707d200>

This is the topmost collection view. This is followed by many lines about locking and unlocking this collection view, followed by

Removing focus scroll animator entry for environment <DXETV.LayoutCollectionView: 0x10707d200>

I don't know if this is normal or not.

After I move focus from Button1 to Button2, I see

Updating focus with context <UIFocusUpdateContext: 0x6000033200a0: previouslyFocusedItem=<DXETV.CustomButton 0x104232610>, nextFocusedItem=<DXETV.CustomButton 0x104312900>, focusHeading=Down>:
Moving focus from <DXETV.CustomButton: 0x104232610> to <DXETV.CustomButton: 0x104312900> in focus system <UIFocusSystem: 0x60000370c900>.

Which seems correct.

When I move focus from Button2 to Button3, I get this, which is now expected:

Updating focus with context <UIFocusUpdateContext: 0x60000330c5a0: previouslyFocusedItem=<DXETV.CustomButton 0x104312900>, nextFocusedItem=<DXETV.CustomButton 0x1043134d0>, focusHeading=Down>:
Moving focus from <DXETV.CustomButton: 0x104312900> to <DXETV.CustomButton: 0x1043134d0> in focus system <UIFocusSystem: 0x60000370c900>.

Followed by another round of creating and removing a focus scroll animator entry, this time for the middle collection view.

Moving from Button3 back to Button2 also looks as expected:

Updating focus with context <UIFocusUpdateContext: 0x600003318f00: previouslyFocusedItem=<DXETV.CustomButton 0x1043134d0>, nextFocusedItem=<DXETV.CustomButton 0x104312900>, focusHeading=Up>:
Moving focus from <DXETV.CustomButton: 0x1043134d0> to <DXETV.CustomButton: 0x104312900> in focus system <UIFocusSystem: 0x60000370c900>.

But here, everything stops. When I press the up arrow again to go back to Button1, nothing happens. Nothing is printed to the console, and the focused button does not change.

Any hints as to what may be wrong or how to debug this further would be most appreciated!!!

UIButton starts out focused but can't navigate back to it
 
 
Q