Rely on core to provide accesskey/title attributes, update search toggle location in DOM

Bug: T299980
Depends-on: Ide214de5f246b38689799e20db9e8a4671d9b7ac
Change-Id: I43eb04ec095cc9c1d683df9da05887595c2eddfb
This commit is contained in:
bwang 2022-04-13 14:53:46 -05:00 committed by Jon Robson
parent 21f124dad5
commit 58b6831e4d
6 changed files with 12 additions and 13 deletions

View File

@ -5,7 +5,6 @@
"skinname-vector": "Vector legacy (2010)",
"skinname-vector-2022": "Vector (2022)",
"vector-specialversion-name": "Vector",
"tooltip-pt-watchlist-2": "A list of pages you are monitoring for changes",
"vector-skin-desc": "Provides 2 Vector skins:\n* 2011 - The Modern version of MonoBook with fresh look and many usability improvements.\n* 2022 - The Vector built as part of the WMF [[mw:Desktop Improvements]] project.",
"prefs-vector-enable-vector-1-label": "Use Legacy Vector",
"prefs-vector-enable-vector-1-help": "Over the next few years, we will be gradually updating the Vector skin. Legacy Vector will allow you to view the old version of Vector (as of December 2019). To learn more about the updates, go to our [[mw:Reading/Web/Desktop_Improvements|project page]].",

View File

@ -20,7 +20,6 @@
"skinname-vector": "{{name}}",
"skinname-vector-2022": "{{name}}",
"vector-specialversion-name": "{{name}}",
"tooltip-pt-watchlist-2": "Watchlist link tooltip.",
"vector-skin-desc": "{{desc|what=skin|name=Vector|url=https://www.mediawiki.org/wiki/Skin:Vector}}",
"prefs-vector-enable-vector-1-label": "Label for the checkbox to force Legacy Vector operation accessible via Special:Preferences. When this checkbox is enabled, the December 2019 of Vector is used. When this checkbox is disabled, the actively developed version of Vector is used instead.",
"prefs-vector-enable-vector-1-help": "Detail explaining the operation of the prefs-vector-enable-vector-1-label checkbox.",

View File

@ -235,6 +235,7 @@ abstract class SkinVector extends SkinMustache {
private function getCreateAccountHTML( $returnto, $class, $includeIcon ) {
$createAccountData = $this->buildCreateAccountData( $returnto );
$createAccountData['single-id'] = 'pt-createaccount';
unset( $createAccountData['icon'] );
if ( $includeIcon ) {
$class = array_merge(
@ -267,9 +268,7 @@ abstract class SkinVector extends SkinMustache {
* @return string
*/
private function getAnonMenuBeforePortletHTML( $returnto, $useCombinedLoginLink ) {
// 'single-id' must be provided for `makeLink` to populate `title`, `accesskey` and other attributes
$loginData = $this->buildLoginData( $returnto, $useCombinedLoginLink );
$loginData['single-id'] = 'pt-login';
$loginData['class'] = [
'vector-menu-content-item',
'vector-menu-content-item-login',
@ -314,7 +313,6 @@ abstract class SkinVector extends SkinMustache {
unset( $logoutLinkData['icon'] );
return $templateParser->processTemplate( 'UserLinks__logout', [
'msg-tooltip-pt-logout' => $this->msg( 'tooltip-pt-logout' ),
'htmlLogout' => $this->makeLink( 'logout', $logoutLinkData )
] );
}
@ -619,13 +617,14 @@ abstract class SkinVector extends SkinMustache {
// At lower resolutions the search input is hidden search and only the submit button is shown.
// It should behave like a form submit link (e.g. submit the form with no input value).
// We'll wire this up in a later task T284242.
$searchBoxData['data-collapse-icon'] = [
$collapseIconAttrs = Linker::tooltipAndAccesskeyAttribs( 'search' );
$searchBoxData['data-collapse-icon'] = array_merge( [
'href' => Title::newFromText( $searchBoxData['page-title'] )->getLocalUrl(),
'label' => $this->msg( 'search' ),
'icon' => 'wikimedia-search',
'is-quiet' => true,
'class' => 'search-toggle',
];
], $collapseIconAttrs );
return $searchBoxData;
}

View File

@ -3,6 +3,8 @@
{{#id}}id="{{.}}"{{/id}}
{{#tabindex}}tabindex="{{.}}"{{/tabindex}}
{{#event}}data-event-name="{{.}}"{{/event}}
{{#title}}title="{{.}}"{{/title}}
{{#accesskey}}accesskey="{{.}}"{{/accesskey}}
class="mw-ui-button{{#is-quiet}} mw-ui-quiet{{/is-quiet}}{{#icon}} mw-ui-icon mw-ui-icon-element mw-ui-icon-{{.}}{{/icon}} {{class}}">
{{{html-vector-button-icon}}}<span>{{label}}</span>
{{#href}}</a>{{/href}}

View File

@ -2,6 +2,11 @@
See @typedef SearchData
}}
<div{{#is-primary}} id="p-search"{{/is-primary}} role="search" class="{{class}} vector-search-box">
{{#is-collapsible}}
{{#data-collapse-icon}}
{{>Button}}
{{/data-collapse-icon}}
{{/is-collapsible}}
<div>
{{#is-legacy}}
<h3 {{{html-user-language-attributes}}}>
@ -36,9 +41,4 @@
</div>
</form>
</div>
{{#is-collapsible}}
{{#data-collapse-icon}}
{{>Button}}
{{/data-collapse-icon}}
{{/is-collapsible}}
</div>

View File

@ -1,4 +1,4 @@
{{!-- The #pt-logout ID is required for the AJAX enabled logout in mediawiki.page.ready to work.}}
<div id="pt-logout" class="vector-user-menu-logout" title="{{msg-tooltip-pt-logout}}">
<div id="pt-logout" class="vector-user-menu-logout">
{{{htmlLogout}}}
</div>