Commit a3720312 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Ensure the Omnibox Dropdown does not autoselect suggestions.

This change fixes a problem, where a call to resetSelection() not only
rewinds the selected suggestion position, but also selects the top
suggestion, invoking an associated onSelect action.

this causes problems with headers specifically, where HeaderSuggestion
needs to clear the Omnibox input field when selected (eg. using DPAD
on keyboard) as header suggestions do not have any associated
suggestion text.

This change ensures the resetSelection() call clears any currently
selected input, allowing the keyboard management logic to let user
select the first suggestion on the list by using DPAD down key.

Tested on phones and tablets, with physical keyboard and accessibility
features turned on.

Bug: 1150877
Change-Id: Id794281e8aec33c5ea955b4ba0b4741d47237a26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553152
Commit-Queue: Tomasz Wiszkowski <ender@google.com>
Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829950}
parent ce70d4a9
......@@ -63,7 +63,7 @@ class OmniboxSuggestionsDropdownAdapter extends SimpleRecyclerViewAdapter {
/** Ensures selection is reset to beginning of the list. */
void resetSelection() {
setSelectedViewIndex(0);
setSelectedViewIndex(RecyclerView.NO_POSITION);
}
/**
......
......@@ -210,6 +210,7 @@ public class MostVisitedTilesTest {
throws InterruptedException {
// Skip past the 'what-you-typed' suggestion.
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
checkUrlBarTextIs(mTile1.url.getSpec());
sendKey(KeyEvent.KEYCODE_DPAD_RIGHT);
......@@ -230,6 +231,7 @@ public class MostVisitedTilesTest {
throws InterruptedException {
// Skip past the 'what-you-typed' suggestion.
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
checkUrlBarTextIs(mTile1.url.getSpec());
sendKey(KeyEvent.KEYCODE_DPAD_RIGHT);
......@@ -250,6 +252,7 @@ public class MostVisitedTilesTest {
throws InterruptedException {
// Skip past the 'what-you-typed' suggestion.
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
checkUrlBarTextIs(mTile1.url.getSpec());
sendKey(KeyEvent.KEYCODE_DPAD_RIGHT);
......
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