Merge "Disable section toggling on mobile when replying"

This commit is contained in:
jenkins-bot 2023-03-13 14:41:46 +00:00 committed by Gerrit Code Review
commit 319b5be506

View file

@ -193,6 +193,12 @@ CommentController.prototype.setup = function ( mode, hideErrors, suppressNotific
OO.ui.Element.static.scrollIntoView( commentController.newListItem, { OO.ui.Element.static.scrollIntoView( commentController.newListItem, {
padding: scrollPaddingCollapsed padding: scrollPaddingCollapsed
} ); } );
// Disable section collapsing on mobile. If the section were collapsed it would be hard to
// find your comment again. The "Return to reply" tool is broken by section collapsing as
// the reply widget is hidden and therefore not measureable. It's also possible the page is
// not long enough to trigger the "Return to reply" tool.
$( this.newListItem ).parents( '.collapsible-block' ).prev().addClass( 'collapsible-heading-disabled' );
} }
if ( if (
@ -217,6 +223,8 @@ CommentController.prototype.setup = function ( mode, hideErrors, suppressNotific
} }
$( commentController.newListItem ).empty().append( replyWidget.$element ); $( commentController.newListItem ).empty().append( replyWidget.$element );
$( this.newListItem ).parents( '.collapsible-block' ).prev().addClass( 'collapsible-heading-disabled' );
commentController.setupReplyWidget( replyWidget, {}, suppressNotifications ); commentController.setupReplyWidget( replyWidget, {}, suppressNotifications );
commentController.showAndFocus(); commentController.showAndFocus();
@ -373,6 +381,8 @@ CommentController.prototype.showAndFocus = function () {
}; };
CommentController.prototype.teardown = function ( mode ) { CommentController.prototype.teardown = function ( mode ) {
$( this.newListItem ).parents( '.collapsible-block' ).prev().removeClass( 'collapsible-heading-disabled' );
if ( mode === 'refresh' ) { if ( mode === 'refresh' ) {
$( this.newListItem ).empty().append( $( this.newListItem ).empty().append(
$( '<span>' ).text( mw.msg( 'discussiontools-replywidget-loading' ) ) $( '<span>' ).text( mw.msg( 'discussiontools-replywidget-loading' ) )