From c89cce0219646502b4d338213d112a528373bdc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Thu, 21 Sep 2017 15:31:24 +0200 Subject: [PATCH] autoscroll emoji suggestions box --- .../mastodon/components/autosuggest_textarea.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index e94900c828..1c7ffe1968 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -162,6 +162,15 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } } + componentDidUpdate () { + if (this.refs.selected) { + if (this.refs.selected.scrollIntoViewIfNeeded) + this.refs.selected.scrollIntoViewIfNeeded(); + else + this.refs.selected.scrollIntoView({ behavior: 'auto', block: 'nearest' }); + } + } + render () { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus } = this.props; const { suggestionsHidden, selectedSuggestion } = this.state; @@ -202,6 +211,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
{suggestions.map((suggestion, i) => (