diff --git a/.storybook/icons.less b/.storybook/icons.less index 9da1d46f8..b14fd6023 100644 --- a/.storybook/icons.less +++ b/.storybook/icons.less @@ -87,3 +87,10 @@ .vector-user-menu-legacy #pt-userpage a { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAx0lEQVQ4jdXSzQmEQAwFYEuYUixhSwgkA8mQgKXYgS3YgXZgCZagHWgHuxf14t8osssGcv145CVJvjk+hBRFK2TrkK1D0cqHkN7CUBRI7L21KAqXMIDModiwD9oAkLlH0i3L+ooGiTWPAPPfJQTIHLGOB9h46YZnKS+3PI8PISW2GkV7FO2Jrb79h4+ODyElsYJYm437NSRWRCWdylgj++U0u+UAZI5E22hsWW03UWQtr2NT66zlCjz8uzNQbFiDN7F5/xB8aj57Ynp2FKI0bAAAAABJRU5ErkJggg==") !important; } + +.mw-ui-icon-wikimedia-speechBubbles:before { + background-image: linear-gradient(transparent, transparent), url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2220%22 height=%2220%22 viewBox=%220 0 20 20%22%3E%3Ctitle%3Espeech bubbles%3C/title%3E%3Cg fill=%22%23000%22%3E%3Cpath d=%22M17 4v7a2 2 0 01-2 2H4v1a2 2 0 002 2h10l4 4V6a2 2 0 00-2-2zM6 10H0v6z%22/%3E%3Crect width=%2216%22 height=%2212%22 rx=%222%22/%3E%3C/g%3E%3C/svg%3E"); +} +.mw-ui-icon-wikimedia-history:before { + background-image: linear-gradient(transparent, transparent), url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2220%22 height=%2220%22 viewBox=%220 0 20 20%22%3E%3Ctitle%3Ehistory%3C/title%3E%3Cg fill=%22%23000%22%3E%3Cpath d=%22M9 6v5h.06l2.48 2.47 1.41-1.41L11 10.11V6z%22/%3E%3Cpath d=%22M10 1a9 9 0 00-7.85 13.35L.5 16H6v-5.5l-2.38 2.38A7 7 0 1110 17v2a9 9 0 000-18z%22/%3E%3C/g%3E%3C/svg%3E"); +} diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 6741b660d..a4b040095 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -326,21 +326,19 @@ class SkinVector extends SkinMustache { /** * Generate data needed to generate the sticky header. * Lack of i18n is intentional and will be done as part of follow up work. + * @param array $searchBoxData * @return array */ - private function getStickyHeaderData() { + private function getStickyHeaderData( $searchBoxData ) { return [ 'data-primary-action' => !$this->shouldHideLanguages() ? $this->getULSButtonData() : null, 'data-button-start' => [ - 'href' => '#p-search', 'label' => $this->msg( 'search' ), 'icon' => 'wikimedia-search', 'is-quiet' => true, 'class' => 'vector-sticky-header-search-toggle', ], - 'data-search' => [ - 'class' => $this->shouldSearchExpand() ? self::SEARCH_EXPANDING_CLASS : '', - ], + 'data-search' => $searchBoxData, 'data-buttons' => [ self::TALK_ICON, self::HISTORY_ICON, self::NO_ICON, self::NO_ICON ] @@ -382,9 +380,24 @@ class SkinVector extends SkinMustache { 'is-language-in-header' => $this->isLanguagesInHeader(), + 'data-search-box' => $this->getSearchData( + $parentData['data-search-box'], + !$this->isLegacy(), + // is primary mode of search + true, + 'searchform' + ), 'data-vector-sticky-header' => VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_STICKY_HEADER - ) ? $this->getStickyHeaderData() : false, + ) ? $this->getStickyHeaderData( + $this->getSearchData( + $parentData['data-search-box'], + // Collapse inside search box is disabled. + false, + false, + 'vector-sticky-search-form' + ) + ) : false, ] ); if ( $skin->getUser()->isRegistered() ) { @@ -406,13 +419,6 @@ class SkinVector extends SkinMustache { ); } - $commonSkinData['data-search-box'] = $this->getSearchData( - $commonSkinData['data-search-box'], - !$this->isLegacy(), - true, - 'searchform' - ); - return $commonSkinData; } diff --git a/includes/templates/SearchBox.mustache b/includes/templates/SearchBox.mustache index 9231856a2..784f7c4d4 100644 --- a/includes/templates/SearchBox.mustache +++ b/includes/templates/SearchBox.mustache @@ -14,7 +14,12 @@ class="vector-search-box-inner" {{#input-location}} data-search-loc="{{.}}"{{/input-location}}> + {{#is-primary}}{{{html-input-attributes}}} id="searchInput"{{/is-primary}} + {{^is-primary}} + type="search" name="search" + placeholder="{{msg-searchsuggest-search}}" + {{/is-primary}} + /> {{! We construct two buttons (for 'go' and 'fulltext' search modes), but only one will be visible and actionable at a time (they are overlaid on top of each other in CSS). diff --git a/includes/templates/StickyHeader.mustache b/includes/templates/StickyHeader.mustache index 616ba9fec..fb306c906 100644 --- a/includes/templates/StickyHeader.mustache +++ b/includes/templates/StickyHeader.mustache @@ -7,9 +7,7 @@ {{/data-button-start}} {{#data-search}} -