Commit f2280797 authored by John Lee's avatar John Lee Committed by Commit Bot

WebUI Tab Strip: Set keyboard focus when opening via keyboard

If the tab strip was opened using a keyboard (and not touch), the view
now tells the UI handler to inform the front-end that keyboard focus
has moved into the tab strip. The front-end will automatically focus the
first tab and add the focus indicators.

Bug: 1135358
Change-Id: I3524e186638c61c128af9d1041d5573774ba14bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2449941Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814022}
parent 4aaa35e4
...@@ -659,7 +659,7 @@ void WebUITabStripContainerView::EndDragToOpen( ...@@ -659,7 +659,7 @@ void WebUITabStripContainerView::EndDragToOpen(
: WebUITabStripOpenCloseReason::kDragRelease); : WebUITabStripOpenCloseReason::kDragRelease);
} }
void WebUITabStripContainerView::TabCounterPressed() { void WebUITabStripContainerView::TabCounterPressed(const ui::Event& event) {
const bool new_visibility = !GetVisible(); const bool new_visibility = !GetVisible();
if (new_visibility) { if (new_visibility) {
RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter); RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter);
...@@ -676,9 +676,9 @@ void WebUITabStripContainerView::TabCounterPressed() { ...@@ -676,9 +676,9 @@ void WebUITabStripContainerView::TabCounterPressed() {
SetContainerTargetVisibility(new_visibility, SetContainerTargetVisibility(new_visibility,
WebUITabStripOpenCloseReason::kOther); WebUITabStripOpenCloseReason::kOther);
if (GetVisible() && tab_counter_->HasFocus()) { if (GetVisible() && event.IsKeyEvent()) {
// Automatically move focus to the tab strip WebUI if the focus is // Automatically move focus to the tab strip WebUI if the tab strip
// currently on the toggle button. // was opened via a key event.
SetPaneFocusAndFocusDefault(); SetPaneFocusAndFocusDefault();
} }
} }
......
...@@ -96,7 +96,7 @@ class WebUITabStripContainerView : public TabStripUIEmbedder, ...@@ -96,7 +96,7 @@ class WebUITabStripContainerView : public TabStripUIEmbedder,
void EndDragToOpen(base::Optional<WebUITabStripDragDirection> void EndDragToOpen(base::Optional<WebUITabStripDragDirection>
fling_direction = base::nullopt); fling_direction = base::nullopt);
void TabCounterPressed(); void TabCounterPressed(const ui::Event& event);
void SetContainerTargetVisibility(bool target_visible, void SetContainerTargetVisibility(bool target_visible,
WebUITabStripOpenCloseReason reason); WebUITabStripOpenCloseReason reason);
......
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