Skip to content

GlobalDrawer: move delegate into view when focused

Christoph Wolk requested to merge cwo/kirigami:globaldrawer-focus-center into master

GlobalDrawer has some logic to keep an entry in view if its checked status changes. This is not true for focus changes though; if keyboard navigation is used to traverse the entries in the global drawer (through tabbing or through arrow keys), the focused element can be outside the visible part of the Flickable, making it impossible to read.

This change adds some logic to the delegate, moving the visible area of the Flickable to center the newly focused item as much as possible given the dimensions of the content. It also exposes a new function ensureVisibile() that consumers can call to properly handle visibility for items not created as regular actions in GlobalDrawer, such as those provided in topContent.


This can be tested with e.g. Discover. Make sure that the window is small enough so that the list of entries in the sidebar drawer does not fit, then focus the search bar and press Shift-Tab. The bottom element of the list, here "Plasma Addons", receives focus, but is not visible. (Orca will read it out). With the patch, the drawer will scroll so that the focused element is visible.

Edited by Christoph Wolk

Merge request reports

Loading