mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
CommentController#showAndFocus: Use replyWidgetPromise
We shouldn't assume callers of this method have waited for the replyWidget to be built. Bug: T354292 Change-Id: Ic66b4f04b8786b07f520e329adda37efcf498dad
This commit is contained in:
parent
555cfcc622
commit
811dce7bf7
|
@ -345,12 +345,19 @@ CommentController.prototype.focus = function () {
|
|||
this.replyWidget.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Scroll the widget into view and focus it
|
||||
*/
|
||||
CommentController.prototype.showAndFocus = function () {
|
||||
var commentController = this;
|
||||
this.replyWidget.scrollElementIntoView( { padding: scrollPadding } )
|
||||
if ( this.replyWidgetPromise ) {
|
||||
this.replyWidgetPromise.then( function ( replyWidget ) {
|
||||
replyWidget.scrollElementIntoView( { padding: scrollPadding } )
|
||||
.then( function () {
|
||||
commentController.focus();
|
||||
} );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
CommentController.prototype.teardown = function ( mode ) {
|
||||
|
|
|
@ -430,7 +430,6 @@ function init( $container, state ) {
|
|||
// If the reply widget is already open, activate it.
|
||||
// Reply links are also made unclickable using 'pointer-events' in CSS, but that doesn't happen
|
||||
// for new section links, because we don't have a good way of visually disabling them.
|
||||
// (And it also doesn't work on IE 11.)
|
||||
if ( activeCommentId === commentId ) {
|
||||
activeController.showAndFocus();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue