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

Commit 45b82c2

Browse files
committed
Tab should cycle between results
Fix #5878 Auditors: @bsclifton
1 parent 47d489b commit 45b82c2

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

app/renderer/components/navigation/urlBar.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ class UrlBar extends React.Component {
199199
this.hideAutoComplete()
200200
break
201201
case KeyCodes.TAB:
202-
this.hideAutoComplete()
202+
if (this.shouldRenderUrlBarSuggestions) {
203+
if (e.shiftKey) {
204+
windowActions.previousUrlBarSuggestionSelected()
205+
} else {
206+
windowActions.nextUrlBarSuggestionSelected()
207+
}
208+
e.preventDefault()
209+
}
203210
break
204211
default:
205212
this.keyPressed = true
@@ -315,6 +322,7 @@ class UrlBar extends React.Component {
315322
switch (e.keyCode) {
316323
case KeyCodes.UP:
317324
case KeyCodes.DOWN:
325+
case KeyCodes.TAB:
318326
case KeyCodes.ESC:
319327
return
320328
}

test/lib/brave.js

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ var exports = {
114114
UP: '\ue013',
115115
PAGEDOWN: '\uE00F',
116116
END: '\uE010',
117+
TAB: '\ue004',
117118
NULL: '\uE000'
118119
},
119120

test/navbar-components/urlBarTest.js

+15
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,21 @@ describe('urlBar tests', function () {
265265
})
266266
})
267267

268+
describe('highlight suggestions with tab', function () {
269+
it('autofills from selected suggestion', function * () {
270+
// now type something
271+
yield this.app.client
272+
.keys('https://br')
273+
.waitForInputText(urlInput, 'https://brave.com')
274+
// hit down
275+
.keys(Brave.keys.TAB)
276+
.waitForInputText(urlInput, 'https://brave.com/test')
277+
// hit up
278+
.keys(Brave.keys.SHIFT + Brave.keys.TAB)
279+
.waitForInputText(urlInput, 'https://brave.com')
280+
})
281+
})
282+
268283
describe('highlight suggestions', function () {
269284
it('autofills from selected suggestion', function * () {
270285
// now type something

0 commit comments

Comments
 (0)