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

Commit e78b6e3

Browse files
author
Jake Teton-Landis
committed
fix mouse focus issue with optionIndexes
1 parent 466b985 commit e78b6e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/combobox.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ module.exports = React.createClass({
115115
props.onClick = this.selectOption.bind(this, child);
116116
props.onFocus = this.handleOptionFocus;
117117
props.onKeyDown = this.handleOptionKeyDown.bind(this, child);
118-
props.onMouseEnter = this.handleOptionMouseEnter.bind(this, index);
118+
props.onMouseEnter = this.handleOptionMouseEnter.bind(
119+
this, optionIndexes.length - 1);
119120
}.bind(this));
120121
return {
121122
optionIndexes: optionIndexes,
@@ -170,6 +171,7 @@ module.exports = React.createClass({
170171

171172
handleOptionFocus: function() {
172173
// see `handleOptionBlur`
174+
console.log('handleOptionFocus');
173175
clearTimeout(this.blurTimer);
174176
},
175177

@@ -347,6 +349,8 @@ module.exports = React.createClass({
347349
return inputValue || value;
348350
},
349351

352+
// index is the index of the option among the list of only options,
353+
// NOT among all elements in the DOM
350354
focusOptionAtIndex: function(index) {
351355
if (!this.state.isOpen && this.state.value)
352356
return this.focusSelectedOption();

0 commit comments

Comments
 (0)