tvOS search: grid keyboard will not slide when search results are focused

Hi there!

I am working on a tvOS application with a UISearchController. I have a problem when the grid keyboard is selected in the settings (Settings->General->Keyboard Layout).

When the search results are focused, I expect the keyboard to slide to the leading edge to let the search results fill all the available width. This is the standard behavior in all Apple applications. But I can't get that behavior. The keyboard will stay when the search results are focused:

Missing image. I'll retry to upload it hoping that it will work this time

I followed the video Discover search suggestions for Apple TV (the only one I could find where this topic was dealt with) and did everything mentioned:

  • Embed the UISearchController inside a UISearchContainerViewController
  • Set the collection view of the search results controller as the observed one with setContentScrollView in the search results controller (as explained in the doc)

In the video, the behavior I expect is mentioned, and it seems that no additional steps are required to obtain it (~ 9'52''):

Our keyboard is highly adaptable to various languages and input methods. You should consider this when laying out your search results. Here are a few examples of alternate layouts. For people using IR remotes, we'll display a grid keyboard. While typing, the search results will only occupy some of the screen width, and then they'll slide in to fill the screen when focused.

Is there something I am missing? Or is this a bug and I should file a radar?

Environment

  • tvOS 15
  • UIKit
  • The problem exists on the Simulator as well as on the Apple TVs I tested: 4K (2nd generation) and HD

Note

I could not find a 3rd party application that gets this behavior. All applications using a UISearchController I could try have the same problem.

Having the same issue, thought this is because of collection inside of collection (vertical main collection with horizontal collections inside cells) but changing this to horizontal scroll doesn't help. Spotify app is also hiding keyboard. So this is not only in apple apps

YouTube is hiding the keyboard too. I wonder if Spotify and YouTube use UIKit or TVMLKit for their search tab. When inspecting the search controller, it embeds the search results controller view inside another view and doesn't set any constraint on it. I guess they only set the frame of the containing view (the X origin is ~500 points). When the keyboard looses the focus, the containing view should have its origin updated to snap to the safe area leading edge, and the keyboard trailing edge should be set to the window leading edge. Maybe they forgot to implement this behavior.

Note: I filed a bug through Feedback Assistant two months ago but did not get any answer so far. Still open.

The search view on tvOS with keyboard was designed to have the keyboard stay on screen at all time. That's the default behavior clients sees. The hiding behavior currently is reserved for 1st party apps at this time, but it'd be great to file a feedback for.

Thanks for taking the time to answer. I still have interrogations if I may:

  • it is said in the video that the keyboard will slide. Is it only for 3rd party apps?
  • the line keyboard does hide for 3rd party apps. Is it different from the grid keyboard?
  • with the grid keyboard it’s not possible to align the leading elements of a collection view with the leading edge of the search container. Not without clipping the elements when focused. Could you tell me if there is a proper solution for that ?
tvOS search: grid keyboard will not slide when search results are focused
 
 
Q