1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-02 16:58:53 +09:00

Fix composer not getting focus after reply confirmation dialog

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.
This commit is contained in:
Thibaut Girka 2018-12-21 18:40:50 +01:00 committed by ThibG
parent 0605c004a5
commit 1a3088364f

View File

@ -39,13 +39,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;
this.handleModalClose();
}
if (this.props.children) {