Commit 2246e017 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

Local NTP, Realbox: Fixes bug where realbox gets filled with deleted match

Prevents the remove icon from getting focus by preventing the default
action on 'mousedown' event. Otherwise, the realbox wrapper's focusin
handler selects the given match which fills in the realbox input.

Bug: 1017497
Change-Id: I9522d83079b9a05e815e6020cc383504180e4fab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1877659
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709256}
parent 4792c39b
......@@ -1496,10 +1496,13 @@ function populateAutocompleteMatches(matches) {
const icon = document.createElement('button');
icon.title = configData.translatedStrings.removeSuggestion;
icon.classList.add(CLASSES.REMOVE_ICON);
icon.onmousedown = e => {
e.preventDefault(); // Stops default browser action (focus)
};
icon.onclick = e => {
matchElBeingDeleted = matchEl;
window.chrome.embeddedSearch.searchBox.deleteAutocompleteMatch(i);
e.preventDefault();
e.preventDefault(); // Stops default browser action (navigation)
};
const remove = document.createElement('div');
......
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