Commit 99bd43cf authored by Collin Baker's avatar Collin Baker Committed by Commit Bot

Move focus to web contents when DownloadShelfView is closed

Currently, keyboard focus disappears if the DownloadShelfView is closed while it is focused. This change moves focus to the web contents when it is closing.

Bug: 846466
Change-Id: I2fd24d5e918a6be7ce46299b31b53d5fa92aaa97
Reviewed-on: https://chromium-review.googlesource.com/c/1302871
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603601}
parent 833fa18f
...@@ -390,6 +390,16 @@ void DownloadShelfView::Closed() { ...@@ -390,6 +390,16 @@ void DownloadShelfView::Closed() {
++i; ++i;
} }
} }
// If we had keyboard focus, calling SetVisible(false) causes keyboard focus
// to be completely lost. To prevent this, we focus another view: the web
// contents. TODO(collinbaker): https://crbug.com/846466 Fix
// AccessiblePaneView::SetVisible or FocusManager to make this unnecessary.
auto* focus_manager = GetFocusManager();
if (focus_manager && Contains(focus_manager->GetFocusedView())) {
get_parent()->contents_web_view()->RequestFocus();
}
SetVisible(false); SetVisible(false);
} }
......
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