From ff41f60a21f9f9a3cef35d9341086d5d0afaa68d Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Thu, 18 May 2017 01:22:07 -0400 Subject: [PATCH] Don't do suggestion actions on non-char key presses Auditors: @bsclifton Fix #5878 Test comming in a follow up commit now, just pushing without so you can get a build going --- app/renderer/components/navigation/urlBar.js | 3 +++ test/navbar-components/urlBarSuggestionsTest.js | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/app/renderer/components/navigation/urlBar.js b/app/renderer/components/navigation/urlBar.js index 405f8478c58..e864e8abd44 100644 --- a/app/renderer/components/navigation/urlBar.js +++ b/app/renderer/components/navigation/urlBar.js @@ -324,6 +324,9 @@ class UrlBar extends React.Component { case KeyCodes.DOWN: case KeyCodes.TAB: case KeyCodes.ESC: + case KeyCodes.LEFT: + case KeyCodes.SHIFT: + case KeyCodes.RIGHT: return } if (this.props.isSelected) { diff --git a/test/navbar-components/urlBarSuggestionsTest.js b/test/navbar-components/urlBarSuggestionsTest.js index 5ef5b6646c2..875a934bca8 100644 --- a/test/navbar-components/urlBarSuggestionsTest.js +++ b/test/navbar-components/urlBarSuggestionsTest.js @@ -66,6 +66,23 @@ describe('urlBarSuggestions', function () { .waitForElementCount(urlBarSuggestions, 0) }) + it('deactivated suggestions do not pop back up when left or shift is pressed', function * () { + yield this.app.client + .setInputText(urlInput, 'Page 1') + .waitForExist(urlBarSuggestions + ' li.suggestionItem[data-index="0"]') + .keys(Brave.keys.BACKSPACE) + .waitForElementCount(urlBarSuggestions, 0) + .keys(Brave.keys.LEFT) + .pause(50) + .keys(Brave.keys.SHIFT + Brave.keys.LEFT) + .pause(50) + .keys(Brave.keys.LEFT) + .pause(50) + .keys(Brave.keys.SHIFT) + .pause(50) + .waitForElementCount(urlBarSuggestions, 0) + }) + it('deactivates suggestions on delete', function * () { yield this.app.client .setInputText(urlInput, 'Page 1')