diff --git a/i18n/en.json b/i18n/en.json index 234414c..4e39e67 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -10,6 +10,7 @@ "vector-opt-out-tooltip": "Change your settings to go back to the old look of the skin (legacy Vector)", "vector.css": "/* All CSS here will be loaded for users of the Vector skin */", "vector.js": "/* All JavaScript here will be loaded for users of the Vector skin */", + "vector-action-toggle-sidebar": "Toggle sidebar", "vector-action-addsection": "Add topic", "vector-action-delete": "Delete", "vector-action-move": "Move", diff --git a/i18n/qqq.json b/i18n/qqq.json index cebe737..b350642 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -21,6 +21,7 @@ "vector-opt-out-tooltip": "Used as the tooltip for the Vector opt-out link", "vector.css": "{{optional}}", "vector.js": "{{optional}}", + "vector-action-toggle-sidebar": "Accessibility label for the button that toggles the sidebar's visibility, as well as audible presentation for screen readers.", "vector-action-addsection": "Used in the Vector skin. See for example {{canonicalurl:Talk:Main_Page|useskin=vector}}\n{{Identical|Add topic}}", "vector-action-delete": "Used in the Vector skin, as the name of a tab at the top of the page. See for example {{canonicalurl:Translating:MediaWiki|useskin=vector}}\n\n{{Identical|Delete}}", "vector-action-move": "Used in the Vector skin, on the tabs at the top of the page. See for example {{canonicalurl:Talk:Main_Page|useskin=vector}}\n\n{{Identical|Move}}", diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 84880ac..d9eb3cf 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -80,11 +80,17 @@ class SkinVector extends SkinTemplate { */ public function getDefaultModules() { $modules = parent::getDefaultModules(); - // add vector skin styles and vector module - $module = $this->isLegacy() - ? 'skins.vector.styles.legacy' : 'skins.vector.styles'; - $modules['styles']['skin'][] = $module; - $modules['core'][] = $this->isLegacy() ? 'skins.vector.legacy.js' : 'skins.vector.js'; + + if ( $this->isLegacy() ) { + $modules['styles']['skin'][] = 'skins.vector.styles.legacy'; + $modules[Constants::SKIN_NAME] = 'skins.vector.legacy.js'; + } else { + $modules['styles'] = array_merge( + $modules['styles'], + [ 'skins.vector.styles', 'mediawiki.ui.icon', 'skins.vector.icons' ] + ); + $modules[Constants::SKIN_NAME][] = 'skins.vector.js'; + } return $modules; } diff --git a/includes/VectorTemplate.php b/includes/VectorTemplate.php index a7dd37e..dc16a65 100644 --- a/includes/VectorTemplate.php +++ b/includes/VectorTemplate.php @@ -371,6 +371,9 @@ class VectorTemplate extends BaseTemplate { ), 'array-portals-rest' => array_slice( $props, 1 ), 'data-portals-first' => $firstPortal, + 'msg-toggle-sidebar-button-label' => $this->msg( 'vector-action-toggle-sidebar' )->text(), + // [todo] fetch user preference when logged in (T246427). + 'sidebar-visible' => false ]; } diff --git a/includes/templates/Sidebar.mustache b/includes/templates/Sidebar.mustache index dab6422..5dc965d 100644 --- a/includes/templates/Sidebar.mustache +++ b/includes/templates/Sidebar.mustache @@ -7,9 +7,33 @@ MenuDefinition data-portals-first MenuDefinition[] array-portals-rest emphasized-sidebar-action data-emphasized-sidebar-action For displaying an emphasized action in the sidebar. + string msg-toggle-sidebar-button-label The label used by the sidebar button. + boolean sidebar-visible For users that want to see the sidebar on initial render, this should be + true. }} -