Fix composer not getting focus after reply confirmation dialog (#9602)

The modal-handling code gives back focus to the element focused when the
modal opened. However, in the case of reply confirmation, it would do so
*after* the composer code itself requested focus.
rebase/4.0.0rc2
ThibG 2018-12-21 18:52:41 +01:00 committed by Eugen Rochko
parent de3cecf37a
commit a6079a42b6
1 changed files with 4 additions and 2 deletions

View File

@ -33,13 +33,15 @@ export default class ModalRoot extends React.PureComponent {
} else if (!nextProps.children) {
this.setState({ revealed: false });
}
if (!nextProps.children && !!this.props.children) {
this.activeElement.focus();
this.activeElement = null;
}
}
componentDidUpdate (prevProps) {
if (!this.props.children && !!prevProps.children) {
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'));
this.activeElement.focus();
this.activeElement = null;
}
if (this.props.children) {
requestAnimationFrame(() => {