Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist
example/bundle.js
example/bundle.js.map
coverage
/.idea/
8 changes: 6 additions & 2 deletions lib/ReactTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ class ReactTags extends React.Component {
pressUpKey.call(this, e)
}

if (e.key === KEYS.DOWN_ARROW || e.key === KEYS.DOWN_ARROW_COMPAT) {
if (e.key === KEYS.DOWN_ARROW || e.key === KEYS.DOWN_ARROW_COMPAT || e.key === KEYS.TAB) {
pressDownKey.call(this, e)
}

if (!this.props.allowNew && this.state.options.length && this.state.index === -1) {
pressDownKey.call(this, e)
}
}
Expand Down Expand Up @@ -308,7 +312,7 @@ ReactTags.defaultProps = {
suggestionsTransform: null,
autoresize: true,
classNames: CLASS_NAMES,
delimiters: [KEYS.TAB, KEYS.ENTER],
delimiters: [KEYS.ENTER],
minQueryLength: 2,
maxSuggestionsLength: 6,
allowNew: false,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"Serhiy Yefremenko",
"Paul Shannon",
"Herdis Maria",
"Sibiraj S"
"Sibiraj S",
"Metagûsto"
],
"license": "MIT",
"repository": "https://github.com/i-like-robots/react-tags",
Expand Down
11 changes: 3 additions & 8 deletions spec/ReactTags.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,11 @@ describe('React Tags', () => {

key('ArrowDown')

expect(input.getAttribute('aria-activedescendant')).toEqual(results[0].id)
expect(results[0].className).toMatch(/is-active/)
expect(input.getAttribute('aria-activedescendant')).toEqual(results[1].id)
expect(results[1].className).toMatch(/is-active/)

key('ArrowDown', 'ArrowDown')

expect(input.getAttribute('aria-activedescendant')).toEqual(results[2].id)
expect(results[2].className).toMatch(/is-active/)

key('ArrowDown')

expect(input.getAttribute('aria-activedescendant')).toEqual(results[0].id)
expect(results[0].className).toMatch(/is-active/)

Expand Down Expand Up @@ -412,7 +407,7 @@ describe('React Tags', () => {

sinon.assert.notCalled(props.onAddition)

type(query); key('ArrowDown', 'ArrowDown', 'Enter')
type(query); key('ArrowDown', 'Enter')

sinon.assert.calledOnce(props.onAddition)
sinon.assert.calledWith(props.onAddition, { id: 196, name: 'United Kingdom' })
Expand Down