From 88fd9b151a38fa7dbb90cb15b2e01634c08a2f58 Mon Sep 17 00:00:00 2001 From: Jeroen Dhollander Date: Mon, 23 Dec 2019 19:54:30 +0000 Subject: [PATCH] Fix tab support in Assistant settings This is a temporary fix. The real fix will be to move away from the Content Service and back to |views::WebView|. This is tracked in b/146351046. - Embedded UI: - TAB and shift-TAB works for settings. - TAB and shift-TAB works for webview based Assistant response (to the query |weather|). - Open Settings, click on other window, click back on settings, verify TAB and shift-TAB still work. - Standalone UI: - TAB and shift-TAB works for settings. - TAB and shift-TAB works for webview based Assistant response (to the query |weather|). Bug: 145213680 Change-Id: If0f39d4911409f177fb1f93525205ad7392bdd35 Tests: Manually tested that: Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1979633 Reviewed-by: Xiaohui Chen Commit-Queue: Jeroen Dhollander Cr-Commit-Position: refs/heads/master@{#727225} --- ash/assistant/ui/assistant_web_view.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ash/assistant/ui/assistant_web_view.cc b/ash/assistant/ui/assistant_web_view.cc index bc44faf0e8c1a7..b88f652969f972 100644 --- a/ash/assistant/ui/assistant_web_view.cc +++ b/ash/assistant/ui/assistant_web_view.cc @@ -86,8 +86,19 @@ void AssistantWebView::OnFocus() { } void AssistantWebView::AboutToRequestFocusFromTabTraversal(bool reverse) { - if (contents_) + if (contents_) { + // TODO(b/146351046): Temporary workaround for b/145213680. Should be + // removed once we have moved off of the Content Service (tracked in + // b/146351046). + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce( + [](base::WeakPtr view) { + if (view) + view->GetFocusManager()->ClearFocus(); + }, + weak_factory_.GetWeakPtr())); contents_->FocusThroughTabTraversal(reverse); + } } void AssistantWebView::InitLayout() {