Commit 4e00bd2a authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: default focus for tabstrip to active tab

When navigating to the tab as an accessible pane (via F6), focus currently gets
dropped at the first tab, which is not as useful as it might be. It is easy to
get to the start (via Home) or end (via End) of the strip but not to get to the
active tab. As such, focus should land on the active tab by default instead.

Bug: 910687
Change-Id: I0d70e171557d5591745c117bdca067f77c4feaec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857303Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706048}
parent 4494ca6a
......@@ -2025,6 +2025,13 @@ void TabStrip::OnThemeChanged() {
FrameColorsChanged();
}
views::View* TabStrip::GetDefaultFocusableChild() {
int active = controller_->GetActiveIndex();
return active != TabStripModel::kNoTab
? tab_at(active)
: AccessiblePaneView::GetDefaultFocusableChild();
}
BrowserRootView::DropIndex TabStrip::GetDropIndex(
const ui::DropTargetEvent& event) {
// Force animations to stop, otherwise it makes the index calculation tricky.
......
......@@ -306,6 +306,7 @@ class TabStrip : public views::AccessiblePaneView,
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override;
void OnThemeChanged() override;
views::View* GetDefaultFocusableChild() override;
// BrowserRootView::DropTarget:
BrowserRootView::DropIndex GetDropIndex(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment