diff --git a/src/components/views/emojipicker/EmojiPicker.js b/src/components/views/emojipicker/EmojiPicker.js index f5a977f930..d6d79d7b8c 100644 --- a/src/components/views/emojipicker/EmojiPicker.js +++ b/src/components/views/emojipicker/EmojiPicker.js @@ -142,8 +142,6 @@ class EmojiPicker extends React.Component { this.onClickEmoji = this.onClickEmoji.bind(this); this.scrollToCategory = this.scrollToCategory.bind(this); this.updateVisibility = this.updateVisibility.bind(this); - - window.bodyRef = this.bodyRef; } updateVisibility() { diff --git a/src/components/views/emojipicker/Search.js b/src/components/views/emojipicker/Search.js index ca6a664763..19da7c2e6c 100644 --- a/src/components/views/emojipicker/Search.js +++ b/src/components/views/emojipicker/Search.js @@ -25,11 +25,21 @@ class Search extends React.PureComponent { onChange: PropTypes.func.isRequired, }; + constructor(props) { + super(props); + this.inputRef = React.createRef(); + } + + componentDidMount() { + // For some reason, neither the autoFocus nor just calling focus() here worked, so here's a setTimeout + setTimeout(() => this.inputRef.current.focus(), 0); + } + render() { return (