Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Tab should cycle between results
Browse files Browse the repository at this point in the history
Fix #5878

Auditors: @bsclifton
  • Loading branch information
bbondy committed May 18, 2017
1 parent 5187733 commit d1607d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/renderer/components/navigation/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,14 @@ class UrlBar extends React.Component {
this.hideAutoComplete()
break
case KeyCodes.TAB:
this.hideAutoComplete()
if (this.shouldRenderUrlBarSuggestions) {
if (e.shiftKey) {
windowActions.previousUrlBarSuggestionSelected()
} else {
windowActions.nextUrlBarSuggestionSelected()
}
e.preventDefault()
}
break
default:
this.keyPressed = true
Expand Down Expand Up @@ -315,6 +322,7 @@ class UrlBar extends React.Component {
switch (e.keyCode) {
case KeyCodes.UP:
case KeyCodes.DOWN:
case KeyCodes.TAB:
case KeyCodes.ESC:
return
}
Expand Down
1 change: 1 addition & 0 deletions test/lib/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ var exports = {
UP: '\ue013',
PAGEDOWN: '\uE00F',
END: '\uE010',
TAB: '\ue004',
NULL: '\uE000'
},

Expand Down
15 changes: 15 additions & 0 deletions test/navbar-components/urlBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ describe('urlBar tests', function () {
})
})

describe('highlight suggestions with tab', function () {
it('autofills from selected suggestion', function * () {
// now type something
yield this.app.client
.keys('https://br')
.waitForInputText(urlInput, 'https://brave.com')
// hit down
.keys(Brave.keys.TAB)
.waitForInputText(urlInput, 'https://brave.com/test')
// hit up
.keys(Brave.keys.SHIFT + Brave.keys.TAB)
.waitForInputText(urlInput, 'https://brave.com')
})
})

describe('highlight suggestions', function () {
it('autofills from selected suggestion', function * () {
// now type something
Expand Down

0 comments on commit d1607d8

Please sign in to comment.