Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset highlightedIndex to defaultHighlightIndex after selecting item #195

Merged
merged 1 commit into from
Sep 21, 2017

Conversation

SpaceK33z
Copy link
Contributor

What:
Fixes #194

Why:

As a user I'd expect highlightedIndex to always have the value that I initially set it to, after selecting an item. I.e. react-select also works like this. It allows the user to quickly hit enter when the right item is the first in the list.

How:

highlightedIndex was always set to null when selecting an item. I changed that to be set to the defaultHighlightedIndexprop.

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@codecov-io
Copy link

Codecov Report

Merging #195 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #195   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines         267    267           
  Branches       61     61           
=====================================
  Hits          267    267
Impacted Files Coverage Δ
src/downshift.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d48031f...cf9b56e. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect! Thanks!

@kentcdodds kentcdodds merged commit efbbe19 into downshift-js:master Sep 21, 2017
@kentcdodds
Copy link
Member

Would you like to add yourself to the contributors table?

@SpaceK33z SpaceK33z deleted the highlightedindex-fix branch September 21, 2017 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

defaultHighlightedIndex is set back to null after first selection
3 participants