Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392401 )

Change subject: Special:UserRights: Prevent FOUC by hiding in PHP instead of 
JavaScript
......................................................................

Special:UserRights: Prevent FOUC by hiding in PHP instead of JavaScript

Change-Id: Ibfbbb00efbe660e4e7b7ba26b4faf6f5b7ed2a2f
---
M includes/specials/SpecialUserrights.php
M resources/src/mediawiki.special/mediawiki.special.userrights.js
2 files changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/392401/1

diff --git a/includes/specials/SpecialUserrights.php 
b/includes/specials/SpecialUserrights.php
index 5c779f0..14324e2 100644
--- a/includes/specials/SpecialUserrights.php
+++ b/includes/specials/SpecialUserrights.php
@@ -916,7 +916,12 @@
                                                $expiryHtml .= 
$expiryFormOptions->getHTML() . '<br />';
 
                                                // Add custom expiry field
-                                               $attribs = [ 'id' => 
"mw-input-wpExpiry-$group-other" ];
+                                               $attribs = [
+                                                       'id' => 
"mw-input-wpExpiry-$group-other",
+                                                       // Initial hide the 
input field to prevent a FOUC on loading
+                                                       // JavaScript will 
unhide the input field when in use
+                                                       'style' => 'display: 
none',
+                                               ];
                                                if ( 
$checkbox['disabled-expiry'] ) {
                                                        $attribs['disabled'] = 
'disabled';
                                                }
diff --git a/resources/src/mediawiki.special/mediawiki.special.userrights.js 
b/resources/src/mediawiki.special/mediawiki.special.userrights.js
index 702f4c4..d3494f7 100644
--- a/resources/src/mediawiki.special/mediawiki.special.userrights.js
+++ b/resources/src/mediawiki.special/mediawiki.special.userrights.js
@@ -9,5 +9,5 @@
        // Dynamically show/hide the "other time" input under each dropdown
        $( '.mw-userrights-nested select' ).on( 'change', function ( e ) {
                $( e.target.parentNode ).find( 'input' ).toggle( $( e.target 
).val() === 'other' );
-       } ).trigger( 'change' );
+       } );
 }( jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/392401
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfbbb00efbe660e4e7b7ba26b4faf6f5b7ed2a2f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <foma...@googlemail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to