Set URL fragment when recovering auto-save on mobile

This triggers Toggler.js in MF to open the section, which
may not be stored in sessionStorage, as DT can recover
from localStorage.

Bug: T338920
Change-Id: I695e2d423b5159ef4cdcefc0f4d4d0a05f46879b
This commit is contained in:
Ed Sanders 2023-06-14 18:04:19 +01:00
parent 98a7afe26e
commit 8a8c7270cf

View file

@ -480,6 +480,11 @@ function init( $container, state ) {
mode = storage.get( 'reply/' + comment.id + '/mode' );
$link = $( commentNodes[ i ] );
setupController( comment, $link, mode, true, !state.firstLoad );
if ( OO.ui.isMobile() ) {
var urlFragment = mw.util.escapeIdForLink( comment.id );
// Force the section to expand on mobile (T338920)
location.hash = '#' + urlFragment;
}
break;
}
}