Fix reply button on media modal not giving focus to compose form (#17626)
* Avoid compose form and modal management fighting for focus * Fix reply button on media modal footer not giving focus to compose form
This commit is contained in:
parent
d4592bbfcd
commit
2cd31b3177
7 changed files with 50 additions and 19 deletions
|
@ -163,8 +163,13 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
selectionStart = selectionEnd;
|
||||
}
|
||||
|
||||
this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd);
|
||||
this.autosuggestTextarea.textarea.focus();
|
||||
// Because of the wicg-inert polyfill, the activeElement may not be
|
||||
// immediately selectable, we have to wait for observers to run, as
|
||||
// described in https://github.com/WICG/inert#performance-and-gotchas
|
||||
Promise.resolve().then(() => {
|
||||
this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd);
|
||||
this.autosuggestTextarea.textarea.focus();
|
||||
}).catch(console.error);
|
||||
} else if(prevProps.isSubmitting && !this.props.isSubmitting) {
|
||||
this.autosuggestTextarea.textarea.focus();
|
||||
} else if (this.props.spoiler !== prevProps.spoiler) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue