-
Notifications
You must be signed in to change notification settings - Fork 229
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
Tab acts unexpectedly #255
Comments
Here's my temporary solution, a.k.a the hackiest hack I ever hacked together: class TypeaheadHack extends React.Component {
componentDidMount = () => {
ReactDOM.findDOMNode(this).addEventListener("keydown", e => {
if(((e.key && e.key == "Tab") || e.keyCode == 9) && !e.shiftKey) {
var current = e.target;
var all = document.querySelectorAll('input, button, area, object, select, textarea');//no anchors!
var currentIndex;
for(var i = 0; i < all.length; i++){
if(current.isEqualNode(all[i])){
currentIndex = i;
break;
}
}
setTimeout(() => {
all[currentIndex + 1].focus();
}, 50);
}
}, true);
}
render () {
return (
<Typeahead {...this.props}/>
);
}
} What I'm doing here is hackily wrapping the Typeahead in another component which I can access it's Please just merge the PR that fixes this! |
Hi. There are problems with how tab behaves:
Tab should have it's default behaviour just like it does with normal inputs. The caret navigation shouldn't be mixed with the tab navigation. At least there should be an option to control this. Currently you can't even tab forward as
react-typeahead
intentionally does for some odd reason. A fix to this would be Optionally propagate keydown events #140 but it was never merged due to there not being documentation & tests (which isn't that big of a deal).Tab for some reason selects the first option available. But, for example if my options are "foo 1", "foo 2", and "foo 3", and I type "foo 2" it will select "foo 1" which for some reason shows as the first option. Also, for some reason custom options are ignored even when the option is on.
This is terrible UX and makes it really hard to use.
P.S: If this project is abandoned, please just say so in the README.md to save people a lot of time.
The text was updated successfully, but these errors were encountered: