state = {
modifierOpen: false,
- placement: null,
+ readyToFocus: false,
};
handleDocumentClick = e => {
componentDidMount () {
document.addEventListener('click', this.handleDocumentClick, false);
document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
+
+ // Because of https://github.com/react-bootstrap/react-bootstrap/issues/2614 we need
+ // to wait for a frame before focusing
+ requestAnimationFrame(() => {
+ this.setState({ readyToFocus: true });
+ if (this.node) {
+ const element = this.node.querySelector('input[type="search"]');
+ if (element) element.focus();
+ }
+ });
}
componentWillUnmount () {
showSkinTones={false}
backgroundImageFn={backgroundImageFn}
notFound={notFoundFn}
- autoFocus
+ autoFocus={this.state.readyToFocus}
emojiTooltip
/>
state = {
active: false,
loading: false,
+ placement: null,
};
setRef = (c) => {