mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 06:13:43 +01:00
fix(components/autosuggest_textarea): Race condition regarding onBlur (#3631)
This commit is contained in:
parent
0f1b1d78b1
commit
8cf8ce4ac0
1 changed files with 2 additions and 8 deletions
|
@ -124,13 +124,7 @@ class AutosuggestTextarea extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlur = () => {
|
onBlur = () => {
|
||||||
// If we hide the suggestions immediately, then this will prevent the
|
|
||||||
// onClick for the suggestions themselves from firing.
|
|
||||||
// Setting a short window for that to take place before hiding the
|
|
||||||
// suggestions ensures that can't happen.
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({ suggestionsHidden: true });
|
this.setState({ suggestionsHidden: true });
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuggestionClick = (e) => {
|
onSuggestionClick = (e) => {
|
||||||
|
@ -191,7 +185,7 @@ class AutosuggestTextarea extends ImmutablePureComponent {
|
||||||
key={suggestion}
|
key={suggestion}
|
||||||
data-index={suggestion}
|
data-index={suggestion}
|
||||||
className={`autosuggest-textarea__suggestions__item ${i === selectedSuggestion ? 'selected' : ''}`}
|
className={`autosuggest-textarea__suggestions__item ${i === selectedSuggestion ? 'selected' : ''}`}
|
||||||
onClick={this.onSuggestionClick}
|
onMouseDown={this.onSuggestionClick}
|
||||||
>
|
>
|
||||||
<AutosuggestAccountContainer id={suggestion} />
|
<AutosuggestAccountContainer id={suggestion} />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue