scrollbox keyboard navigation doesn't work properly

Hi,

I noticed the following while using a scrollbox together with keyboard navigation. When the scrollbox contains a widget that itself does not support keyboard navigation, but a child in that widget does, it does not receive keyboard focus, because the scrollbox attemps navigation at this direct child of the scrollbox, but fails to do so and continues further up in the chain.

Repro:

  1. create a custom widget containing a panel which contains a button.
  2. create a scrollbox (horizontal) which contains a list of those custom widgets.
  3. wrap the scrollbox in some other container which in turn contains some buttons that could receive focus.
  4. now click on one of the custom widgets to make it receive focus and navigate through them using the keyboard. Notice that the custom widgets do not receive focus, instead some random button in the top widget receives focus.

Expected: when navigating left and right through my scrollbox the buttons in my custom widget receive keyboard focus.

Incorrect code in my opinion:

FNavigationReply SScrollBox::OnNavigation(…)
this should detect if the attempt to navigate to the widget is even feasible and should certainly not skip the button contained within it. The navigation happens due to the check HasUserFocusedDescendants, which is true in my case since i got a button in my custom widget which has focus.

My current workaround:

i made the navigation for the childs of the scrollbox explicit and update it when a child gets removed or added. Any better workaround is appreciated! Or if you tell me this is by design, please tell me how i should get the right behavior in my case.

Hello ,

After taking a look at your post and I have a suggestion for you that may be viable. I was able to gain access to the children of the widget by overriding the OnFocusRecieved (image below for reference). This appears to be working with the setup given in your post.

Example:

Here I have create a new widget that has an overlay and a button (as step one suggested).

Here I have added a print string that fires off when the button is clicked

98053-onfocusrecievedhelp4.png

Here I have used an override on the OnFocusReceived function and I have set the keyboard focus to that of my button. This will allow me to press enter and fire off my print string.

98052-onfucusrecievedhelp.png

Here I have added the custom widget made above to a scroll box (as step two suggested). I have also set the custom widgets’ Is Focusable = true.

You will also note that I have added two buttons to the designer tab (as step three suggested)

After this I added it to the viewport and attempted to navigate the widgets in the scroll box. I found that I was able to navigate the widgets in the scroll box and the other buttons as expected. I found that I was also able to use the buttons and fire off the print string by pressing enter.

If I did not understand your steps as you meant them please feel free to provide an example project and I will be happy to take a closer look. I hope that this information helps.

Make it a great day

Thats exactly my problem, but do you agree this is a bug? I consider this a workaround.

Hello ,

After looking into this issue further I have written up a report ( UE-33074) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day