Add visual Tab order for RpWidget children - #336
Open
rezabakhshilaktasaraei wants to merge 1 commit into
Open
Conversation
rezabakhshilaktasaraei
force-pushed
the
visual-tab-order
branch
5 times, most recently
from
August 15, 2026 11:14
6fc1e12 to
35c1cf7
Compare
rezabakhshilaktasaraei
force-pushed
the
visual-tab-order
branch
from
August 15, 2026 11:47
35c1cf7 to
20d71b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the focusNextPrevChild discussion: instead of a window-level override, a container opts in with setVisualTabOrder(true) and keeps its own children ordered in the focus chain by visual position (row bands top-to-bottom, left-to-right, RTL-mirrored) instead of creation order.
The container never traverses on its own: its focusNextPrevChild re-sorts the chain with setTabOrder and delegates to the base implementation, so the existing overrides (FocusNextPrevChildBlocked layer blocking etc.) keep working - they walk the chain and simply see the visual order.
Every Tab stop of every child is placed, not just the child's first and last one: setTabOrder moves a block only for real compound widgets established through a focus proxy, so linking endpoints would leave the widgets between them behind. Inside a child the stops keep the order they already have in the focus chain, so a nested container that opted in composes with the outer one instead of being undone by it - it is also asked to apply first, so a stale nested order isn't preserved by mistake. Hidden descendants are collected too, since focus traversal skips invisible widgets anyway and they are then already in place when shown.
Every widget on the way is queried, so the lazily granted screen reader focus policy is materialized for all of them, and the state re-applies when the screen reader mode changes - detection is asynchronous on Windows and can also be switched on while the app runs.
Reordering is scheduled from layout, visibility and z-order changes of the widget and of its children. refreshVisualTabOrder() covers changes the container can't see - like a list moving its roving Tab-stop from the arrow keys - and Ui::RefreshVisualTabOrder(widget) does the same from a widget created deeper in the tree, by rewiring every container above it.
RpWidget itself gets no data members: the state lives in a small object created only when a container opts in, kept as its child and found back through a dynamic property. Widgets that never opt in store nothing and the override is just that lookup.
Used by tdesktop for the composer row, the chat top bar, the stacked chat bars, the mute bar and the folders sidebar; effectively a no-op outside screen reader mode, where these children are not Tab-focusable.