Make the RC/Watchlist legend not jump when initially collapsed
authorRoan Kattouw <roan.kattouw@gmail.com>
Thu, 28 Sep 2017 00:09:05 +0000 (17:09 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 28 Sep 2017 19:05:24 +0000 (12:05 -0700)
Look at the collapsed/expanded cookie and add class="mw-collapsed"
if it's going to be collapsed.

This is kind of a prelude to T42812.

Change-Id: Icaca762a9d7b000c973d9275f395623129f67979

includes/specialpage/ChangesListSpecialPage.php
resources/src/mediawiki.special/mediawiki.special.changeslist.css

index 88ec327..dcd14e8 100644 (file)
@@ -1467,8 +1467,10 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        $context->msg( 'recentchanges-legend-heading' )->parse();
 
                # Collapsible
+               $collapsedState = $this->getRequest()->getCookie( 'changeslist-state' );
+               $collapsedClass = $collapsedState === 'collapsed' ? ' mw-collapsed' : '';
                $legend =
-                       '<div class="mw-changeslist-legend">' .
+                       '<div class="mw-changeslist-legend mw-collapsible' . $collapsedClass . '">' .
                                $legendHeading .
                                '<div class="mw-collapsible-content">' . $legend . '</div>' .
                        '</div>';
index 3e1bd4e..532ca86 100644 (file)
@@ -39,3 +39,8 @@
        unicode-bidi: -moz-isolate;
        unicode-bidi: isolate;
 }
+
+/* Prevent FOUC if legend is initially collapsed */
+.mw-changeslist-legend.mw-collapsed .mw-collapsible-content {
+       display: none;
+}