Change ULS content language selector positioning
New Vector introduced a new content language selector trigger. This code was hardcoding a behavior that works for compact language links but is not so appropriate for other uses in the skin, which are out of our control. This patch aims to be a minimal change to allow other kinds of behavior without changing the amount of tech debt. This changes the default ULS dialog behavior to match the requirements shown in the task. Compact language links specific behavior is retained but only enabled for the compact language links trigger. The behavior is chosen depending on the value of isUsingStandaloneLanguageButton(). For future changes, I propose that mw-interlanguage-selector class will not have any styles attached to it. Whoever creates the trigger would be in charge of styling it. Ideally that code would also define the positioning and other behavior, but it is less clear how that can be abstracted in a nice and decoupled way. Bug: T276248 Change-Id: I52da6c2f5a1f25d64f322a3c8f6105da3b244b66
This commit is contained in:
committed by
jenkins-bot
parent
95b1137a57
commit
dd8842517e
@@ -477,20 +477,27 @@
|
||||
ev.preventDefault();
|
||||
|
||||
mw.loader.using( 'ext.uls.mediawiki' ).then( function () {
|
||||
var $target, parent, languageNodes, uls;
|
||||
var $target, parent, languageNodes, standalone, uls;
|
||||
|
||||
$target = $( ev.currentTarget );
|
||||
parent = document.querySelectorAll( '.mw-portlet-lang, #p-lang' )[ 0 ];
|
||||
languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : [];
|
||||
standalone = isUsingStandaloneLanguageButton();
|
||||
|
||||
// Setup click handler for ULS
|
||||
launchULS( $target, mw.uls.getInterlanguageListFromNodes( languageNodes ) );
|
||||
launchULS(
|
||||
$target,
|
||||
mw.uls.getInterlanguageListFromNodes( languageNodes ),
|
||||
// Using this as heuristic for now. May need to reconsider later. Enables
|
||||
// behavior sepcific to compact language links.
|
||||
!standalone
|
||||
);
|
||||
// Trigger the click handler to open ULS
|
||||
$target.trigger( 'click' );
|
||||
// Provide access to display and input settings if this entry point is the single point
|
||||
// of access to all language settings.
|
||||
uls = $target.data( 'uls' );
|
||||
if ( isUsingStandaloneLanguageButton() ) {
|
||||
if ( standalone ) {
|
||||
loadDisplayAndInputSettings( uls );
|
||||
}
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user