react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Troubles with focus

Open soma83 opened this issue 9 years ago • 3 comments

Hello @JedWatson, You posted an example of how to set programatically the focus on a Select:


focusStateSelect () {
		this.refs.stateSelect.focus();
	}

<Select ref="stateSelect" autofocus options={options} simpleValue 
 clearable={this.state.clearable}
 name="selected-state" disabled={this.state.disabled} value={this.state.selectValue} 
onChange={this.updateValue} searchable={this.state.searchable} />

Well it doesn't works for me. I used this very same code, almost, and as I said, doesn't work for me at all. It gives me an error which says focus is not a function instead.

Is there any other solution? Am I missing something? Thanks in advance.

soma83 avatar Apr 24 '17 20:04 soma83

Hi @soma83 sounds like a version issue. It's hard to say without looking at the rest of your code. Were you able to figure it out?

agirton avatar May 20 '17 18:05 agirton

I just noticed this problem earlier today. It seems that the ref is not properly referenced in the example docs, re: States.

current state:

focusStateSelect () {
	this.refs.stateSelect.focus();
}

expected state:

focusStateSelect () {
	this.select.focus();
}

I just made a PR to resolve this issue re: example.

combizs avatar Apr 24 '18 23:04 combizs

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.

bladey avatar May 27 '20 06:05 bladey