urho3d/urho3d

UI - Default TAB order should be left-to-right

Lys0gen opened this issue · 4 comments

For some reason the default tab order of UI elements is right-to-left. Flipping the ternary evaluation result in this line should fix it.
(I don't know if the current behaviour is correct for RTL language environments but if it is: maybe make the direction a setting somewhere in the engine?)

https://github.com/urho3d/Urho3D/blob/c65eaab8a31d2f09c1dead987e1d2a9072922157/Source/Urho3D/UI/UI.cpp#L2010

1vanK commented

How to reproduce the problem?

Have several focusable UI Elements (e.g. LineEdit). Select one, press TAB on your keyboard. It will go to the previous element instead of the next.

1vanK commented

Tested in Editor: View > Editor preferences. Everything works fine.

Indeed you are right, that wasn't the actual cause.

The problem comes from UIElement::SortChildren (which is enabled by default on all elements).
It keeps messing up the order of the child elements when they have the same priority. Very annoying.

I don't know if the default being true is necessary for anything or if that may be changed to false.

For now my personal solution will have to be to do SetSortChildren(false) on all my elements.
Regardless, thanks for your response and sorry for potentially wasting your time.