Browse Source

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.
closed-social-glitch-2
Thibaut Girka 5 years ago
committed by ThibG
parent
commit
1a3088364f
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      app/javascript/flavours/glitch/components/modal_root.js

+ 4
- 2
app/javascript/flavours/glitch/components/modal_root.js 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) {

Loading…
Cancel
Save