From 1453c1023d40941c53a57eb633a54ded90e329ac Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 16 Oct 2022 13:20:23 +0100 Subject: [PATCH] Disable section toggling on mobile when replying Bug: T320753 Depends-On: I5e199d404b622fae014f1f9489f65464dab8295b Change-Id: Ib6c92dc96484282fcc0773991b1a0a80fe97e962 --- modules/CommentController.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/CommentController.js b/modules/CommentController.js index 0796e4ec7..444b8792a 100644 --- a/modules/CommentController.js +++ b/modules/CommentController.js @@ -193,6 +193,12 @@ CommentController.prototype.setup = function ( mode, hideErrors, suppressNotific OO.ui.Element.static.scrollIntoView( commentController.newListItem, { 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 ( @@ -217,6 +223,8 @@ CommentController.prototype.setup = function ( mode, hideErrors, suppressNotific } $( commentController.newListItem ).empty().append( replyWidget.$element ); + $( this.newListItem ).parents( '.collapsible-block' ).prev().addClass( 'collapsible-heading-disabled' ); + commentController.setupReplyWidget( replyWidget, {}, suppressNotifications ); commentController.showAndFocus(); @@ -373,6 +381,8 @@ CommentController.prototype.showAndFocus = function () { }; CommentController.prototype.teardown = function ( mode ) { + $( this.newListItem ).parents( '.collapsible-block' ).prev().removeClass( 'collapsible-heading-disabled' ); + if ( mode === 'refresh' ) { $( this.newListItem ).empty().append( $( '' ).text( mw.msg( 'discussiontools-replywidget-loading' ) )