CrOS Shelf: Allow focus to switch from status widget to shelf

Currently, moving focus with the Tab key within the shelf can never get
out of either the status widget or the shelf itself. We're trying to
move to a world where all elements visually on the shelf can be part
of the focus cycle.

This makes it possible, when reaching either end of the status widget,
to focus the most intuitive (visually) child in the shelf (first or

This actually generalizes a behavior that already exists but only for
the login/OOBE shelf.

This change also fixes the calculation of the first_visible_index in
ShelfView to take into account tablet mode changes (and in
non-tablet-mode, first_visible_index_ was always 0, which is wrong
because the back button isn't visible).

The next step will be to do the reverse, and to focus the status widget
when reaching either end of the shelf.

Bug: 753409,891080
Change-Id: I47ab7fa995e48618939dd5c0612102ea1ec63aef
Commit-Queue: Manu Cornet <>
Reviewed-by: Xiyuan Xia <>
Cr-Commit-Position: refs/heads/master@{#632977}
5 files changed